[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?



Hi Nic,

Thanks for the reply, can you be more specific? ÂConsider follow scenario, Â

support in time T, socket event A, B, C is ready, Â

in time T+1, in A's event hander, I created a timer event X, ÂI hope the execution order will beÂ

B, C, X,

so that in time T+2 i can haveÂ

C, X, Y(created by B's event handler) .

So as you said, I should lower X's priority if I want to have it run later than C(those are already active at the time?) . But what happens after C there has been a new socket event D? Âwouldn't X be delayed further down ?

became C , D(newly executed), X, Y , which is still not quite what I want.

Please advise,

Cheers.
Â


On Tue, Sep 3, 2013 at 9:31 AM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
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.