1 // Bugzilla 11309 - std.concurrency: OwnerTerminated message doesn't work 2 // We need to assure that the thread dtors of parent threads run before the thread dtors of the child threads. 3 import core.thread, core.sync.semaphore; 4 import core.stdc.stdio; 5 6 __gshared Semaphore sem; 7 ~this()8static ~this() 9 { 10 if (sem !is null) sem.notify(); 11 } 12 main()13void main() 14 { 15 sem = new Semaphore; 16 auto thr = new Thread({assert(sem.wait(1.seconds));}); 17 thr.start(); 18 } 19