my ebase thread perform the following loop constexpr int kFlag = EVLOOP_ONCE; while ((res = event_base_loop(ebase_, kFlag)) == 1) { yield(); }
and the other (main) thread adds periodic timer event. 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(0 == event_add(ev, &tv));
However, I see that this timer event does not run. If I change kFlag
from EVLOOP_ONCE
to 0 it does run well. What am I missing?