I'm having trouble terminating event loops using event_base_loopexit(). The way it works, as I understand it, is by scheduling an event that sets the event_gotterm flag, which will cause the loop to quit after its current iteration. Here's the sequence of function calls:
event_base_loopexit() event_once() evtimer_set() /* this sets ev_base to current_base */ event_add() This uses the event loop associated with current_base to run the callback (event_loopexit_cb()) instead of the base that was passed to event_base_loopexit(), which seems weird, but okay. However, if there's no loop running with current_base, event_loopexit_cb() never gets called so my loop never terminates. One could imagine this happening if you do something like: base_1 = event_init(); base_2 = event_init(); /* current_base is now base_2 */ event_base_loop(base_1, 0); /* somehow call event_base_loopexit(base_1, 0) now */ Why do we schedule a callback to set event_gotterm? This is a boolean flag and we only care if it's zero or non-zero, so why do we need to synchronize access to it? Harry _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users