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; } diff --git a/tests/issue-66-yield-eventloop-exit.d b/tests/issue-66-yield-eventloop-exit.d new file mode 100644 index 0000000..dd7ae64 --- /dev/null +++ b/tests/issue-66-yield-eventloop-exit.d @@ -0,0 +1,19 @@ +/+ dub.sdl: + name "tests" + dependency "vibe-core" path=".." ++/ +module tests; + +import vibe.core.core; + +void main() +{ + bool visited = false; + runTask({ + yield(); + visited = true; + exitEventLoop(); + }); + runApplication(); + assert(visited); +}