diff --git a/source/vibe/core/sync.d b/source/vibe/core/sync.d index 3220e5f..7f5edcc 100644 --- a/source/vibe/core/sync.d +++ b/source/vibe/core/sync.d @@ -802,7 +802,7 @@ unittest { 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; LocalManualEvent l = createManualEvent(); @@ -826,6 +826,22 @@ unittest { 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.