in source/linux/io_epoll_context.cpp [138:173]
void io_epoll_context::run_impl(const bool& shouldStop) {
LOG("run loop started");
auto* oldContext = std::exchange(currentThreadContext, this);
scope_guard g = [=]() noexcept {
std::exchange(currentThreadContext, oldContext);
LOG("run loop exited");
};
while (true) {
// Dequeue and process local queue items (ready to run)
execute_pending_local();
if (shouldStop) {
break;
}
if (timersAreDirty_) {
update_timers();
}
// Check for remotely-queued items.
// Only do this if we haven't submitted a poll operation for the
// completion queue - in which case we'll just wait until we receive the
// completion-queue item).
if (!remoteQueueReadSubmitted_) {
LOG("try_schedule_local_remote_queue_contents()");
remoteQueueReadSubmitted_ = try_schedule_local_remote_queue_contents();
}
if (remoteQueueReadSubmitted_) {
// Check for any new completion-queue items.
acquire_completion_queue_items();
}
}
}