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

Re: [Libevent-users] using event_base_loop withy timer events



On Thu, Oct 22, 2015 at 07:02:53PM +0300, Roman Gershman wrote:
> Hi,
> my ebase thread does the following loop
> 
> while ((res = event_base_loop(ebase_, EVLOOP_ONCE)) == 1) {
> }
> 
> 
> and the other (main) adds timer event that runs every millisecond. It adds
> the event *after* the ebase thread calls event_base_loop.
> 
> event* ev = event_new(base(), -1, EV_PERSIST | EV_TIMEOUT, &PeriodicCb,
> data);
> CHECK_EQ(0, event_add(ev, &tv));
> 
> 
> I see that this event does not run. If I change flags from EVLOOP_ONCE to 0
> it does run well.
> How should I make event base to realize that the new event is added?

Can you please write a sample to reproduce this (~100lines)?

Also can you dump all events after you added timer *and* after
event_base_loop(base, EVLOOP_ONCE) returned, you can use something like
this:
  event_base_dump_events(base, stderr);

And which version of libevent do you use?
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.