… | |
… | |
1464 | if (expect_true (*flag)) |
1464 | if (expect_true (*flag)) |
1465 | return; |
1465 | return; |
1466 | |
1466 | |
1467 | *flag = 1; |
1467 | *flag = 1; |
1468 | |
1468 | |
1469 | ECB_MEMORY_FENCE_RELEASE; |
1469 | ECB_MEMORY_FENCE_RELEASE; /* make sure flag is visible before the wakeup */ |
1470 | |
1470 | |
1471 | pipe_write_skipped = 1; |
1471 | pipe_write_skipped = 1; |
1472 | |
1472 | |
1473 | ECB_MEMORY_FENCE; |
1473 | ECB_MEMORY_FENCE; /* make sure pipe_write_skipped is visible before we check pipe_write_wanted */ |
1474 | |
1474 | |
1475 | if (pipe_write_wanted) |
1475 | if (pipe_write_wanted) |
1476 | { |
1476 | { |
1477 | int old_errno; |
1477 | int old_errno; |
1478 | |
1478 | |
1479 | pipe_write_skipped = 0; /* optimisation only */ |
1479 | pipe_write_skipped = 0; /* just an optimsiation, no fence needed */ |
1480 | |
1480 | |
1481 | old_errno = errno; /* save errno because write will clobber it */ |
1481 | old_errno = errno; /* save errno because write will clobber it */ |
1482 | |
1482 | |
1483 | #if EV_USE_EVENTFD |
1483 | #if EV_USE_EVENTFD |
1484 | if (evfd >= 0) |
1484 | if (evfd >= 0) |
… | |
… | |
2616 | time_update (EV_A_ 1e100); |
2616 | time_update (EV_A_ 1e100); |
2617 | |
2617 | |
2618 | /* from now on, we want a pipe-wake-up */ |
2618 | /* from now on, we want a pipe-wake-up */ |
2619 | pipe_write_wanted = 1; |
2619 | pipe_write_wanted = 1; |
2620 | |
2620 | |
2621 | ECB_MEMORY_FENCE; |
2621 | ECB_MEMORY_FENCE; /* amke sure pipe_write_wanted is visible before we check for potential skips */ |
2622 | |
2622 | |
2623 | if (expect_true (!(flags & EVRUN_NOWAIT || idleall || !activecnt || pipe_write_skipped))) |
2623 | if (expect_true (!(flags & EVRUN_NOWAIT || idleall || !activecnt || pipe_write_skipped))) |
2624 | { |
2624 | { |
2625 | waittime = MAX_BLOCKTIME; |
2625 | waittime = MAX_BLOCKTIME; |
2626 | |
2626 | |
… | |
… | |
2668 | #endif |
2668 | #endif |
2669 | assert ((loop_done = EVBREAK_RECURSE, 1)); /* assert for side effect */ |
2669 | assert ((loop_done = EVBREAK_RECURSE, 1)); /* assert for side effect */ |
2670 | backend_poll (EV_A_ waittime); |
2670 | backend_poll (EV_A_ waittime); |
2671 | assert ((loop_done = EVBREAK_CANCEL, 1)); /* assert for side effect */ |
2671 | assert ((loop_done = EVBREAK_CANCEL, 1)); /* assert for side effect */ |
2672 | |
2672 | |
2673 | pipe_write_wanted = 0; |
2673 | pipe_write_wanted = 0; /* just an optimsiation, no fence needed */ |
2674 | |
2674 | |
2675 | if (pipe_write_skipped) |
2675 | if (pipe_write_skipped) |
2676 | { |
2676 | { |
2677 | assert (("libev: pipe_w not active, but pipe not written", ev_is_active (&pipe_w))); |
2677 | assert (("libev: pipe_w not active, but pipe not written", ev_is_active (&pipe_w))); |
2678 | ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM); |
2678 | ev_feed_event (EV_A_ &pipe_w, EV_CUSTOM); |