apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: select on pipes and sockets
Date Tue, 17 Jun 2003 04:37:49 GMT
At 02:34 PM 6/16/2003, Juan Rivera wrote:

>Instead of using Select, use WSACreateEvent and WSAEventSelect to assign an event to the
socket. Then use WaitOnMultipleObjects to wait on sockets and pipes at the same time.


This theory is good - if you look at the attached apr/poll/win32/poll.c 
you will see I have just such an implementation for you to hack on.  
It still needs one more scrubbing, a few tests still fail.  Just switch 
from poll/unix to poll/win32 in your apr.dsp and libapr.dsp files, and
you can start experimenting with file handles.

However, calling wait on a file HANDLE isn't the same as polling it for
specific events such as POLLIN, POLLOUT, POLLPRI etc.

I discovered this trying to poll the pipe handle in httpd-2.0/server/mpm/winnt's
nt_eventlog.c source.  The Platform SDK documentation implies that pipe
handles will raise events, when data on the pipe is ready to be read.  This 
wasn't how I discovered they actually work when I attempted to use an
event driven wait loop.

Files and pipes are 'signaled' when requests, e.g. async read or write calls,
are completed.  They aren't signaled for the presence of data to read or some
low threshold for write.

It seems right now like the only method will be some sleep for 100ms and
poll each pipe by hand with PeekNamedPipe().  I'm open to better
ideas that work.
But *don't* let me discourage further research!  The code is attached, please
feel free to experiment.


View raw message