[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Question on event-test.c sample program



On Mon, Jun 13, 2011 at 5:25 PM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
> On Sat, Jun 11, 2011 at 6:19 AM, Ed Day <edday2006@xxxxxxxxx> wrote:
>> I see in the event-test.c sample program the disclaimer that it does
>> not work on non-UNIX platforms (which to me means Windows, maybe
>> others?).
>
> Just Windows as far as I know.
>
>>  It looks like this is an implementation of a named pipe.
>> This has been a problem I have been trying to solve on Windows for
>> awhile now, how to asynchronously read from named pipes and sockets in
>> a standard read event loop.  Can libevent do this through the IOCP
>> capability?
>
> In theory, if the underlying file types support IOCP, then it
> shouldn't be too hard to tweak the IOCP stuff to make it work.  The
> iocp stuff right now is in the files bufferevent_async.c and
> buffer_iocp.c and event_iocp.c.  There are at least three issues that
> you'd need to address:
>  1) The buffer_iocp.c code assumes that bytes are read/written with
> WSASend and WSARecv.  But those only work with sockets: for named
> pipes and named sockets, I think you need WriteFileEx or something?
> Not sure there.
>  2) The bufferevent_async_new() function and friends assumes that
> they have an evutil_socket_t as input, whereas you'd probably want to
> be passing in a HANDLE.
>  3) Not nearly enough people have tested the IOCP stuff yet.  It
> passes unit tests, and it seems to work for me, but if you use it, you
> shouldn't be surprised to find at least one interesting bug.
>
> If the bufferevent model isn't what you're going for here, and you
> need the event model, you might take a look at Chris Davis's
> "hybrid-loop2" branch.  I've uploaded it to my github repository,
> since Chris's site seems to be down.  It tries to add support for
> WaitForMultipleObjects-based polling in addition to select() polling.
> According to Chris, it still needs a lot of work.

Sounds interesting.  I am a newbie to git, so I'm wondering how I
would access this branch?

I did a clone from the main repository and tried to build it on
Windows and found the makefile did not work.  The Makefile.nmake file
in the test directory needs something like the following added:

$(REGRESS_OBJS) : regress.gen.c regress.gen.h

regress.gen.c regress.gen.h : regress.rpc ..\event_rpcgen.py
        python ..\event_rpcgen.py regress.rpc


Ed

>
> hth,
> --
> Nick
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.
>
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.