On Sun, Jun 01, 2008 at 01:51:53PM +0800, liusifan wrote:
 [...]
> Integrate Windows I/O Completion Port into Libevent
> 
> IOCP is true async i/o model, and libevent is event-driven i/o model.
> 
> 1. How to emulate event-driven recv/send ?
> It is possible to use IOCP to emulate event-driven mode. When you
> make read or write calls, pass in a zero-byte buffer (ie, you can
> manage your i/o buffers using event driven semantics). So if you issue
> a read passing in a zero-byte length buffer, your will get notified
> when there is data to read.

This seems pretty promising, and could wind up being a better
short-term idea than our older plan to get IOCP support by making it a
new backend for bufferevents.

How well tested is this?  Can you get the unit tests to pass, at
least, to the extent that the unit tests in 1.4.4 currently pass on
win32?  I'd like people who use libevent on windows to try this code
out; if it works well, we should integrate it.

A useful but not-immediately-necessary followup benchmark would be to
see how well this does against using IOCP in the "normal" (not
"event-driven") way.  If there's no big difference, we can defer
bufferevents IOCP work for a while; but if there's still a significant
amount of overhead here, we should try to apply this patch *and* get
IOCP working with bufferevents.

 [...]
> 6. Source code
> http://spserver.googlecode.com/files/libevent-1.4.4-iocp.zip
> diff file : libevent-1.4.4-iocp\libevent-iocp\diff.txt

  (For future reference, please use unified diffs (generated with diff -u)
  rather than old-style diffs.  They're shorter and (usually) easier
  to read.  This diff is small enough that there's not much worry
  about this one, though.)

> add file : libevent-1.4.4-iocp\WIN32-Code\win32iocp.cpp
                                                     ^^^^ You mean ".c"?

Hm.  This might be better applied against trunk (which will eventually
become libevent 2.0) than against 1.4.4; the 1.4 series is supposed to
be stable, and Big New Features are usually out there...

...but now that I look at the code, it looks like the only big change
is to add a new backend file, which (as far as I can tell) doesn't
require any big changes elsewhere in the code.  I'd be curious to see
what Niels thinks here, but I wouldn't be opposed to checking it into
the stable branch.

BTW: I haven't read the code fully yet, but it looks relatively clean
and straightforward.  I'd appreciate it if people who know Windows
networking better than I do would check it out and comment.

Finally: Thanks, Stephen!  This looks like great work to me so far.

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

Reply via email to