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

Re: [Libevent-users] How to add a timeout event to the tail of current event list?



On Tue, Sep 3, 2013 at 3:09 AM, Yucong Sun <sunyucong@xxxxxxxxx> wrote:
> Hi,
>
> I have a event loop with a mix of network socket based event and timer
> events. in one of the network event handler, I want to create another event
> that run immediately after current set of active network based events.
>
> I'm currently using a timer event (EV_TIMEOUT) and call event_active() right
> away, hoping it will be attached to tail of current active event. But it
> doesn't seem to be working as I thought.
>
> Am I doing something wrong?
>
> Thanks.

Events ordinarily run in the same order in which they first become
active.  If you want a newly active event to have its callback run
before events that were already active, it needs to have a higher
(numerically lower) priority.

Have a look at the event priority functions for more information.

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