Skip site navigation (1) Skip section navigation (2)

Re: Win32 signal code - first try

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "pgsql-hackers-win32" <pgsql-hackers-win32(at)postgresql(dot)org>,"Claudio Natoli" <claudio(dot)natoli(at)memetrics(dot)com>
Subject: Re: Win32 signal code - first try
Date: 2004-01-12 15:46:56
Message-ID: 303E00EBDD07B943924382E153890E5434AA4D@cuthbert.rcsinc.local (view raw, whole thread or download thread mbox)
Lists: 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

> 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.


pgsql-hackers-win32 by date

Next:From: Merlin MoncureDate: 2004-01-12 17:42:43
Subject: Re: Win32 signal code - first try
Previous:From: Magnus HaganderDate: 2004-01-12 15:29:23
Subject: Re: Win32 signal code - first try

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group