--- libev/ev.c 2009/06/29 18:46:52 1.293 +++ libev/ev.c 2009/07/08 02:46:05 1.294 @@ -1360,6 +1360,12 @@ return loop_count; } +unsigned int +ev_loop_depth (EV_P) +{ + return loop_depth; +} + void ev_set_io_collect_interval (EV_P_ ev_tstamp interval) { @@ -2022,11 +2028,11 @@ } } -static int loop_done; - void ev_loop (EV_P_ int flags) { + ++loop_depth; + loop_done = EVUNLOOP_CANCEL; call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */ @@ -2151,6 +2157,8 @@ if (loop_done == EVUNLOOP_ONE) loop_done = EVUNLOOP_CANCEL; + + --loop_depth; } void