void awaitEvent(rtsBool wait) { do { /* Try to de-queue completed IO requests */ workerWaitingForRequests = 1; awaitRequests(wait); workerWaitingForRequests = 0; // If a signal was raised, we need to service it // XXX the scheduler loop really should be calling // startSignalHandlers(), but this is the way that posix/Select.c // does it and I'm feeling too paranoid to refactor it today --SDM if (stg_pending_events != 0) { startSignalHandlers(&MainCapability); return; } // The return value from awaitRequests() is a red herring: ignore // it. Return to the scheduler if !wait, or // // - we were interrupted // - the run-queue is now non- empty } while (wait && sched_state == SCHED_RUNNING && emptyRunQueue(&MainCapability) ); }
void awaitEvent(rtsBool wait) { int ret; do { /* Try to de-queue completed IO requests */ workerWaitingForRequests = 1; ret = awaitRequests(wait); workerWaitingForRequests = 0; if (!ret) { return; /* still hold the lock */ } // Return to the scheduler if: // // - we were interrupted // - new threads have arrived } while (wait && sched_state == SCHED_RUNNING && emptyRunQueue(&MainCapability) ); }