mirror of
https://review.haiku-os.org/buildtools
synced 2025-02-07 06:14:49 +01:00
19 lines
450 B
D
19 lines
450 B
D
// Bugzilla 11309 - std.concurrency: OwnerTerminated message doesn't work
|
|
// We need to assure that the thread dtors of parent threads run before the thread dtors of the child threads.
|
|
import core.thread, core.sync.semaphore;
|
|
import core.stdc.stdio;
|
|
|
|
__gshared Semaphore sem;
|
|
|
|
static ~this()
|
|
{
|
|
if (sem !is null) sem.notify();
|
|
}
|
|
|
|
void main()
|
|
{
|
|
sem = new Semaphore;
|
|
auto thr = new Thread({assert(sem.wait(1.seconds));});
|
|
thr.start();
|
|
}
|