Re: [pgsql-hackers-win32] [PATCHES] fork/exec patch
От | Bruce Momjian |
---|---|
Тема | Re: [pgsql-hackers-win32] [PATCHES] fork/exec patch |
Дата | |
Msg-id | 200312152121.hBFLL7f16251@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: [PATCHES] fork/exec patch (Andrew Dunstan <andrew@dunslane.net>) |
Список | pgsql-hackers |
Andrew Dunstan wrote: > Bruce Momjian wrote: > > >Have you looked at the CONNX signal code on the Win32 page: > > > > http://momjian.postgresql.org/main/writings/pgsql/win32.html > > > >It uses shared memory and events. > > > > > > > > Yes, and I just did again. I guess I must be missing something, though - > I don't see what in that code causes the signalled process to call the > handler corresponding to the signal. Maybe I'm just a little brain dead > today ... In the CONNX code for kill() I see: sprintf(szEventName, "CONNX_SIGNAL_%x", (int) lPID); sprintf(szSharedMemoryName, "CONNX_SMEM_%x", (int) lPID); hSharedMemory = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, szSharedMemoryName); if (hSharedMemory) { /* Call the signal handle for that process.. */ void *pData = MapViewOfFile(hSharedMemory, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(int)); if (pData) { int nReturn; HANDLE hProcessHandle; DWORD ExitCode; *(int *) pData = nSignal; UnmapViewOfFile(pData); /* Open the event handle of the other process */ hEvent = OpenEvent(EVENT_MODIFY_STATE | SYNCHRONIZE, FALSE, szEventName); hProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, lPID); if (hEvent) { SetEvent(hEvent); /* Wait for Event to be processed. */ do { nReturn = WaitForSingleObject(hEvent, 0); Now, I am no Win32 programmer, but the mixture of OpenFileMapping() and OpenEvent() looked promising. :-) -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-hackers по дате отправления: