Mercurial > hg > CbC > CbC_gcc
view libphobos/testsuite/libphobos.init_fini/thread_join.d @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
// 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(); }