Add test that triggers the former bug in ThreadLocalWaiter.emit() and ensures FIFO emit order.

This commit is contained in:
Sönke Ludwig 2017-07-20 16:10:18 +02:00
parent a4b36f08d3
commit 100dfc30ee

View file

@ -802,6 +802,30 @@ unittest {
runEventLoop();
}
unittest {
import vibe.core.core : exitEventLoop, runEventLoop, runTask, sleep;
LocalManualEvent l = createManualEvent();
Task t2;
runTask({
l.wait();
t2.interrupt();
sleep(20.msecs);
exitEventLoop();
});
t2 = runTask({
try {
l.wait();
assert(false, "Shouldn't reach this.");
} catch (InterruptException e) {}
});
runTask({
l.emit();
});
runEventLoop();
}
/** A manually triggered multi threaded cross-task event.