… | |
… | |
1342 | ? EVUNLOOP_ONE |
1342 | ? EVUNLOOP_ONE |
1343 | : EVUNLOOP_CANCEL; |
1343 | : EVUNLOOP_CANCEL; |
1344 | |
1344 | |
1345 | call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */ |
1345 | call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */ |
1346 | |
1346 | |
1347 | while (activecnt) |
1347 | do |
1348 | { |
1348 | { |
1349 | #ifndef _WIN32 |
1349 | #ifndef _WIN32 |
1350 | if (expect_false (curpid)) /* penalise the forking check even more */ |
1350 | if (expect_false (curpid)) /* penalise the forking check even more */ |
1351 | if (expect_false (getpid () != curpid)) |
1351 | if (expect_false (getpid () != curpid)) |
1352 | { |
1352 | { |
… | |
… | |
1370 | { |
1370 | { |
1371 | queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); |
1371 | queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); |
1372 | call_pending (EV_A); |
1372 | call_pending (EV_A); |
1373 | } |
1373 | } |
1374 | |
1374 | |
|
|
1375 | if (expect_false (!activecnt)) |
|
|
1376 | break; |
|
|
1377 | |
1375 | /* we might have forked, so reify kernel state if necessary */ |
1378 | /* we might have forked, so reify kernel state if necessary */ |
1376 | if (expect_false (postfork)) |
1379 | if (expect_false (postfork)) |
1377 | loop_fork (EV_A); |
1380 | loop_fork (EV_A); |
1378 | |
1381 | |
1379 | /* update fd-related kernel structures */ |
1382 | /* update fd-related kernel structures */ |
… | |
… | |
1381 | |
1384 | |
1382 | /* calculate blocking time */ |
1385 | /* calculate blocking time */ |
1383 | { |
1386 | { |
1384 | ev_tstamp block; |
1387 | ev_tstamp block; |
1385 | |
1388 | |
1386 | if (flags & EVLOOP_NONBLOCK || idlecnt) |
1389 | if (expect_false (flags & EVLOOP_NONBLOCK || idlecnt || !activecnt)) |
1387 | block = 0.; /* do not block at all */ |
1390 | block = 0.; /* do not block at all */ |
1388 | else |
1391 | else |
1389 | { |
1392 | { |
1390 | /* update time to cancel out callback processing overhead */ |
1393 | /* update time to cancel out callback processing overhead */ |
1391 | #if EV_USE_MONOTONIC |
1394 | #if EV_USE_MONOTONIC |
… | |
… | |
1437 | if (expect_false (checkcnt)) |
1440 | if (expect_false (checkcnt)) |
1438 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
1441 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
1439 | |
1442 | |
1440 | call_pending (EV_A); |
1443 | call_pending (EV_A); |
1441 | |
1444 | |
1442 | if (expect_false (loop_done)) |
|
|
1443 | break; |
|
|
1444 | } |
1445 | } |
|
|
1446 | while (expect_true (activecnt && !loop_done)); |
1445 | |
1447 | |
1446 | if (loop_done == EVUNLOOP_ONE) |
1448 | if (loop_done == EVUNLOOP_ONE) |
1447 | loop_done = EVUNLOOP_CANCEL; |
1449 | loop_done = EVUNLOOP_CANCEL; |
1448 | } |
1450 | } |
1449 | |
1451 | |