[Libevent-users] libevent win32 issues
Nick Mathewson
nickm at freehaven.net
Tue Nov 6 11:25:04 EST 2007
On Tue, Nov 06, 2007 at 05:09:07PM +0100, Marc Lehmann wrote:
> Hi!
>
> While trying to port libev to win32, I ran into a number of issues with
> libevent proper (which of course still is the major part of the sources).
>
> Specifically:
>
> - evdns.c, httpc and other files include include files such as unistd.h,
> which are not available under windows. consequently, they do not even
> compile on win32 (tested with the visual c compiler).
Ah. It's been a while since I tried to build with anything other than
mingw. Wrapping these includes in #ifdef HAVE_UNISTD_H would be the
right solution. Can you (or anybody) send in a diff?
> - is WIN32-Code/win32.c really the production-ready win32 backend?
> I can hardly believe this, as its basically not doing anything that
> the select backend doesn't do better and faster (for example, the win32
> backend does a linear search over all(!) registered event watchers
> on each event_add/event_del/select call).
It is indeed the production win32 backend. I wish it were faster.
Somebody should send in a diff.
There are two factors that keep the select() implementation on win32
from using the same strategy/code as the one :
1) win32's select() doesn't use bitfields; it uses an array of
sockets. This is because...
2) win32 sockets, unlike unix fds, are not consecutively numbered
integers starting at 0. Thus, it is _NOT_ a good idea to use an
array to map fds to events like select.c does; your array would
be enormous and sparse.
A balanced tree implementation might an improvement here. It would be
nice if somebody would step up and write one.
> additionally, signals are not being handled correctly (race conditions)
> on win32, but thats likely not a big deal on that platform.
win32 signals simply don't work on 1.3e. I've tried to fix them in
trunk. If there are any race conditions there, please let us know.
> Looking around with google it seems that indeed, evdns et. al does not
> build on windows (except when using e.g. cygwin, but thats trivial).
>
> So I wonder if libevent as a whole is supported under windows at all in
> current versions?
I'd like to have everything work on win32. Trunk compiles on mingw
fine. I would like it also to compile under MSVC, but I don't have a
copy of MSVC. That's why diffs would be nice. :)
yrs,
--
Nick Mathewson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: not available
Url : http://monkeymail.org/archives/libevent-users/attachments/20071106/2c206eda/attachment.bin
More information about the Libevent-users
mailing list