Don't exit event loop prematurely. Fixes #66.

Idle processing needs to check whether there are still tasks scheduled to be resumed before setting the exit flag when there are no more waiters (I/O etc.).
This commit is contained in:
Sönke Ludwig 2018-03-06 23:41:56 +01:00
parent c88964337a
commit 66c9aeea57

View file

@ -1140,8 +1140,8 @@ package(vibe) void performIdleProcessing()
if (again) { if (again) {
auto er = eventDriver.core.processEvents(0.seconds); auto er = eventDriver.core.processEvents(0.seconds);
if (er.among!(ExitReason.exited, ExitReason.outOfWaiters)) { if (er.among!(ExitReason.exited, ExitReason.outOfWaiters) && s_scheduler.scheduledTaskCount == 0) {
logDebug("Setting exit flag due to driver signalling exit"); logDebug("Setting exit flag due to driver signalling exit: %s", er);
s_exitEventLoop = true; s_exitEventLoop = true;
return; return;
} }