[PATCH] interruptable accept

Thomas Pfaff tpfaff@gmx.net
Mon Jul 1 05:00:00 GMT 2002

On Mon, 1 Jul 2002, Corinna Vinschen wrote:

> On Mon, Jul 01, 2002 at 01:12:24PM +0200, Thomas Pfaff wrote:
> >
> > This patch is not 100% perfect and could be done better (faster response
> > on incoming signal) with async Events but this would require a much larger
> > patch (Call AsyncEventSelect, WaitForMultipleObjects (socket and signal),
> > check for pending connection and set socket back to blocking mode).
> Do you mean WSAEventSelect?  Would that be actually that big a patch?
> I'm not quite sure if a busy loop is a better solution.

To be corect:
1. Call WSAEventSelect.
2. WSAWaitForMultipleObjects for socket and signal_arrived.
3. If signal arrived set EINTR, WSAEnumNetworkEvents otherwise.
4. do accept, then switch sockets back to nonblocking

I will generate a new patch tonight, then you can decide which one to use.
The select one was easier one to implement because you don't have to
deal with nonblocking I/O and multiple events.

> > 2002-07-01 Thomas Pfaff <tpfaff@gmx.net>
		throw runtime_error( EXCPTN_S( FormatSockErr(
"WSAEventSelect", NULL ) ) );> >
	}> > *net.cc: Include select.h
> > 	(cygwin_accept): If socket is nonblocking check for a pending
> > 	signal every 100ms.
> Ahem, did you have a look into the current CVS sources?  Your patch
> isn't against the latest from CVS.  I've moved most of the socket
> funtionality into the fhandler_socket class the week before.

Seems that i am a little out of date ...


More information about the Cygwin-patches mailing list