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

Re: [Libevent-users] Does libevent support HANDLE processing on Win32 Platform?



On Wed, Dec 19, 2012 at 8:29 PM, zhengfish <zhengfish@xxxxxxxxx> wrote:
> Hi, All,
>
> Does libevent support HANDLE processing on Win32 Platform?
> If there is a HANDLE variable created by the CreateFile API,
>
> How can I user libevent/event_assign() to monitor it?

Libevent doesn't handle HANDLEs. To handle HANDLE handling, we'd need
switch to a WaitForMultipleObjects/RegisterWaitForSingleObject
backend, which would have some drawbacks for implementing the rest of
libevent, and which would require user opt-in because of changes to
EV_WRITE semantics.  Or alternatively, we might add such a backend but
only use it for HANDLES.

As a workaround for now, you can have one thread doing
WaitForMultipleObjects (or use RegisterWaitForSingleObject if that's
more appropriate), and have a callback that responds to the HANDLE
becoming active by calling evnet_active on an event, so that the
event's callback runs in the main thread.

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