Thread: Re: Win32 signal code - first try

Re: Win32 signal code - first try

From
Claudio Natoli
Date:

> > Yes, this fine for polling, but what about when the backend
> > is *sleeping*?  As I understand the backend main processing
> > loop, (and my understanding is far from complete...) the
> > backend waits on 'read from socket' when it is not doing
> > anything.  Correct me if I'm wrong, but this is not
> > interruptible from an APC.
> It is if you use WaitForMultipleObjectsEx(). Or if you use
> WSAEventSelect() and then WaitForSingleObjectEx() on the event (this
> emulates select() the closest)

I'd just as soon as avoid WSAEventSelect; I think that will complicate
matters quite a bit.

FWIW, in a multithreaded version of postgres I'm fooling around with, I
replaced the recv call (where backends spend most of their time waiting)
which a select(small timeout)/SleepEx(0) "busy" loop, which calls to recv
when ready. Works just fine.

Cheers,
Claudio
---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>