[Libevent-users] Re: IOCP writes

Rhythmic Fistman rfistman at gmail.com
Wed Feb 21 16:59:35 EST 2007


> From: "Toby Douglass" <toby.douglass at summerblue.net>

> I'm adding support for IOCP writes.
>
> I've realised, though, that if you issue a write on a socket which
> currently has an outstanding reading, when the IOCP completes, you don't
> immediately know which operation has completed.

You use two different OVERLAPPED structures. The pointers returned
by GetQueuedCompletionStatus will be different.

> The obvious answer is to use select() to check the socket when an IOCP
> completes, but that's very awkward, because of the race conditions, for
> the other operation could complete in the time between the IOCP complete
> and select() and you have multiple threads calling GQCS concurrently.
> Locking would be required, which would be Bad.

That's doesn't sound right..., IOCP type progs really shouldn't need select.

RF

-- 
felix: lightweight threads, HOFs and game scripting.
svn co https://svn.sourceforge.net/svnroot/felix/felix/trunk felix


More information about the Libevent-users mailing list