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

Re: [Libevent-users] fd=-1 events



On Fri, Jan 10, 2014 at 4:24 PM, Александр Смирнов <alexander@xxxxxxxxxx> wrote:
> Greetings!
>
> Thanks in advance for any help you are able to provide! I'm on my very start
> with libevent.
>
> As far as I understand libevent will instantly notify me about any event on
> file descriptor.
>
> But what with events which has no file descriptor (fd = -1) ?
>
> Do I understand right that in blocking mode event_base_loop() will block
> only on real events (based on existing fds) ? So event_active() will not
> have any effect until some real event triggered ?
>
> What I've managed to find out by myself:
> * event_active() does nothing beside placing event on queue to process. so
> it not assumes "immediate" action.
> * event_add calls evmap_io_add which does nothing in case of fd<0
>
> So there is no way to get immediate response for fd=-1 events ?

fd==-1 is used in libevent to indicate an event that has no fd --
either because it is a timer-only event, or because it's used only
with event_active().  It should not have EV_READ or EV_WRITE set.

In general, libevent doesn't have a good notion of "run immediately"
-- the closest that it has is "run this event as part of processing
active events" -- which causes the event to get invoked right away if
the event loop is running, but not otherwise.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.