Rhythmic Fistman wrote:
From: "Toby Douglass" <[EMAIL PROTECTED]>

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.

Yup.  I'll be passing in a struct which contains that overlapped as its
first member.  When it comes back to be, I'll cast the overlapped
pointer to my struct type.  I think this means though I need a malloc
per write, since I have to create the overlapped structure.  That's bad,
since the point of this is high throughput.

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.

Quite right.

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to