From 66c9aeea57fc2573e97ea26c2f940f63fea74e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Tue, 6 Mar 2018 23:41:56 +0100 Subject: [PATCH] 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.). --- source/vibe/core/core.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index cbef0d0..b34b876 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -1140,8 +1140,8 @@ package(vibe) void performIdleProcessing() if (again) { auto er = eventDriver.core.processEvents(0.seconds); - if (er.among!(ExitReason.exited, ExitReason.outOfWaiters)) { - logDebug("Setting exit flag due to driver signalling exit"); + if (er.among!(ExitReason.exited, ExitReason.outOfWaiters) && s_scheduler.scheduledTaskCount == 0) { + logDebug("Setting exit flag due to driver signalling exit: %s", er); s_exitEventLoop = true; return; }