Merge pull request #67 from vibe-d/issue_66_yield_exit_eventloop
Don't exit event loop prematurely.
This commit is contained in:
commit
a1a0d52fe6
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
19
tests/issue-66-yield-eventloop-exit.d
Normal file
19
tests/issue-66-yield-eventloop-exit.d
Normal file
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in a new issue