Increase test timeout.

This commit is contained in:
Sönke Ludwig 2018-02-23 15:49:49 +01:00
parent 58ae644c94
commit f0bdaa0778

View file

@ -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);
});
}