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 <[email protected]> wrote:

> On Tue, Sep 3, 2013 at 3:09 AM, Yucong Sun <[email protected]> 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 [email protected] with
> unsubscribe libevent-users    in the body.
>

Reply via email to