diff --git a/tests/issue-58-task-already-scheduled.d b/tests/issue-58-task-already-scheduled.d index 2b99a38..80cc9f6 100644 --- a/tests/issue-58-task-already-scheduled.d +++ b/tests/issue-58-task-already-scheduled.d @@ -12,6 +12,8 @@ import core.atomic; shared ManualEvent ev; shared size_t counter; +enum ntasks = 500; + shared static this() { ev = createSharedManualEvent(); @@ -22,17 +24,16 @@ void main() setTaskStackSize(64*1024); runTask({ - foreach (x; 0 .. 500) { + foreach (x; 0 .. ntasks) runWorkerTask(&worker); - } }); setTimer(dur!"msecs"(10), { ev.emit(); }); - setTimer(dur!"seconds"(20), { assert(false, "Timers didn't fire within the time limit"); }); + setTimer(dur!"seconds"(60), { assert(false, "Timers didn't fire within the time limit"); }); runApplication(); - assert(atomicLoad(counter) == 500, "Event loop exited prematurely."); + assert(atomicLoad(counter) == ntasks, "Event loop exited prematurely."); } void worker() @@ -41,6 +42,6 @@ void worker() ev.emit(); setTimer(dur!"seconds"(1), { auto c = atomicOp!"+="(counter, 1); - if (c == 500) exitEventLoop(true); + if (c == ntasks) exitEventLoop(true); }); }