We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9ee8ff1 + 005fae0 commit f5bd52dCopy full SHA for f5bd52d
src/core/thread.d
@@ -2668,21 +2668,26 @@ unittest
2668
import core.sync.semaphore;
2669
2670
shared bool inCriticalRegion;
2671
- auto sem = new Semaphore();
+ auto sema = new Semaphore(),
2672
+ semb = new Semaphore();
2673
2674
auto thr = new Thread(
2675
{
2676
thread_enterCriticalRegion();
2677
inCriticalRegion = true;
- sem.notify();
2678
+ sema.notify();
2679
+ semb.wait();
2680
+
2681
Thread.sleep(dur!"msecs"(1));
2682
inCriticalRegion = false;
2683
thread_exitCriticalRegion();
2684
});
2685
thr.start();
2686
- sem.wait();
2687
+ sema.wait();
2688
assert(inCriticalRegion);
2689
+ semb.notify();
2690
2691
thread_suspendAll();
2692
assert(!inCriticalRegion);
2693
thread_resumeAll();
0 commit comments