[Libevent-users] Add support for WINDOWS Overlapped IO
Toby Douglass
toby.douglass at summerblue.net
Mon Dec 11 03:22:45 EST 2006
Zhu Han wrote:
> I have made some mistake when I type the above words. I just mean you
> should
> issue socket_internal_iocp_read firstly and then let the callbacks to
> consume the data. However, in your code, you invoke the callbacks before
> socket_internal_iocp_read. See the following snippet:
> siss->callback_function( siss->socket,
> SOCKET_IOCP_SOCKET_RECV_SUCCESS, siss->read_buffer, byte_count, (void *)
> siss->user_state );
> socket_internal_iocp_read( siss );
Ah. Go look at socket_iocp_add_socket(). You'll find the very first
call to socket_internal_iocp_read() occurs at the end of *that*
function, which gets the read ball rolling.
> As others have pointed out, Async WRITE is important for high-performance
> server.
Yes, it's clear. I'm going to add it.
>> Note though that with GetQueuedCompletionStatus(), the user has no
>> synchronization work to do. The API handles it all behind the scenes.
>
> Single-thread event-driven model just means the event loop is running in
> one thread's context. There a lot of ways to combine it with the multi-thread
> worker.
Ye-e-e-s-s...and no. I think I understand you to mean that we could,
for example, arrange it so we have 2xCPU threads running GQCS and when
one of those threads returns with a complete, we trigger or signal the
main event loop thread? the problem with that surely is going to be the
large amount of thread switching.
More information about the Libevent-users
mailing list