Hi! Here is a first sketch at Win32 signal handling. First a couple of comments:
* This is just two files. It is not integrated with postgresql yet. * Uses named pipes. Shared mem was slightly faster, named pipes a lot cleaner. And the signal handlers themselves should not be performance critical, AFAICS. * Does *not* use user APCs. Why? Well, we had to use polling. And with user APCs we'd have to go into kernel mode (however briefly) on every poll. I replaced that with a simple counter that is checked. Thast way we don't slow down the main path of the program much. * It is then checked again while protected with a critical section, to make sure we don't setp on our own toes from two threads. * A user APC is queued on every signal anyway. This is only to break out of SleepEx/WaitForMultipleObjectsEx etc functions. Normally, we pick the signals up with polling. A couple of questions that need answering: * Where to put the polling. We need to find a reasonable limited number of places. They just need PG_POLL_SIGNALS() there to go. Also, do we want this one #ifdef:ed in every place, or just #define it to nothing at all on non-windows platforms? * Where to put the functions. Right now, it's just a separate file. Do we want to keep it in separate files, or put it in existing files with #ifdef:s? Or combination? * Function names - I haven't looked at naming conventions at all :-) * We need to replace any blocking waits (such as select() and sleep()) with "Ex functions" if we want signals to fire while waiting. Probably a bunch more things I forgot to write right now. Oh, and I've included two very small testfiles - "pgsignal_srvtest.c" which is a sample server and "pgkill.c" which is a sample client. Very ugly code, but it should show how it's intended to be used :-) Anyway. Comments on these points in particular, and in the whole thing in general? Workable path? //Magnus
pgsignal_w32.h
Description: pgsignal_w32.h
pgsignal_w32.c
Description: pgsignal_w32.c
pgsignal_srvtest.c
Description: pgsignal_srvtest.c
pgkill.c
Description: pgkill.c
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]