Add test that reproduces the LocalManualEvent copy bug.
This commit is contained in:
parent
100dfc30ee
commit
f6736d13ab
|
@ -802,7 +802,7 @@ unittest {
|
||||||
runEventLoop();
|
runEventLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest {
|
unittest { // ensure that cancelled waiters are properly handled and that a FIFO order is implemented
|
||||||
import vibe.core.core : exitEventLoop, runEventLoop, runTask, sleep;
|
import vibe.core.core : exitEventLoop, runEventLoop, runTask, sleep;
|
||||||
|
|
||||||
LocalManualEvent l = createManualEvent();
|
LocalManualEvent l = createManualEvent();
|
||||||
|
@ -826,6 +826,22 @@ unittest {
|
||||||
runEventLoop();
|
runEventLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest { // ensure that LocalManualEvent behaves correctly after being copied
|
||||||
|
import vibe.core.core : exitEventLoop, runEventLoop, runTask, sleep;
|
||||||
|
|
||||||
|
LocalManualEvent l = createManualEvent();
|
||||||
|
runTask({
|
||||||
|
auto lc = l;
|
||||||
|
sleep(100.msecs);
|
||||||
|
lc.emit();
|
||||||
|
});
|
||||||
|
runTask({
|
||||||
|
assert(l.wait(1.seconds, l.emitCount));
|
||||||
|
exitEventLoop();
|
||||||
|
});
|
||||||
|
runEventLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** A manually triggered multi threaded cross-task event.
|
/** A manually triggered multi threaded cross-task event.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue