Re: Win32 signal code - first try
От | Merlin Moncure |
---|---|
Тема | Re: Win32 signal code - first try |
Дата | |
Msg-id | 303E00EBDD07B943924382E153890E5434AA4D@cuthbert.rcsinc.local обсуждение исходный текст |
Список | pgsql-hackers-win32 |
Magnus Hagander wrote: > > Yes, this fine for polling, but what about when the backend > > is *sleeping*? As I understand the backend main processing > It is if you use WaitForMultipleObjectsEx(). Or if you use > WSAEventSelect() and then WaitForSingleObjectEx() on the event (this > emulates select() the closest) ok, as long as your are comfortable about that. > Ok. Given this simplifications, we can use a single event, yes :-) > So basically our polling would be: > > if (WaitForSingleObject(hSignalDeliveryEvent,0) == WAIT_OBJECT_0) { > DeliverSignals(); > } > > right? Not quite. Before We WFSO, we must first check if the signal is already pending (as in my example earlier). So we need one mask for pending signals. > If we are uncertain about delivering signals on an APC (with longjmp > considerations etc), we could even just do our QueueUserAPC() ... bleh. If that is the case, we should be using events or your threadsafe counter in your original example, not APC. The whole point of the APC is to keep the 'post poll' code simple and to keep us from having to worry about what is going on in other threads than the main thread. Merlin
В списке pgsql-hackers-win32 по дате отправления: