[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] implement full-blown select(2) for winsock
From: |
Bruno Haible |
Subject: |
Re: [PATCH v2] implement full-blown select(2) for winsock |
Date: |
Wed, 1 Oct 2008 12:54:58 +0200 |
User-agent: |
KMail/1.5.4 |
Paolo Bonzini wrote:
> I agree, but it seems like pipe WaitForSingleObject is broken. You'd
> need a thread polling with PeekNamedPipe, or a busy-waiting loop in the
> main thread altogether.
Maybe we need to reset the pipe from "signaled" to "non-signaled" state
after [Msg]WaitFor..Objects returns, using ResetState()?
Or otherwise, a nearly busy-waiting loop like this:
rpl_select (...)
{
...preparations up to line 346...
for (;;)
{
... code from line 348..418...
if ((timeout && ret == WAIT_TIMEOUT) || rc != 0)
break;
/* MsgWaitForMultipleObjects returned because some handle is in signaled
state, but the handle is not actually ready for I/O. */
Sleep (5);
}
if (!timeout && rc == 0)
abort ();
return rc;
}
Bruno