call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */
- while (activecnt)
+ while (expect_false (!activecnt))
{
#ifndef _WIN32
if (expect_false (curpid)) /* penalise the forking check even more */
call_pending (EV_A);
}
+ if (expect_false (!activecnt))
+ break;
+
/* we might have forked, so reify kernel state if necessary */
if (expect_false (postfork))
loop_fork (EV_A);
{
ev_tstamp block;
- if (flags & EVLOOP_NONBLOCK || idlecnt)
+ if (expect_false (flags & EVLOOP_NONBLOCK || idlecnt || !activecnt))
block = 0.; /* do not block at all */
else
{