Debian Codegraph @

libphobos/testsuite/libphobos.thread/join_detach.d

raw
1 import core.thread;
2 import core.sync.semaphore;
3
4 __gshared Semaphore sem;
5
6 void thread_main ()
7 {
8 sem.notify();
9 }
10
11 void main()
12 {
13 auto th = new Thread(&thread_main);
14 sem = new Semaphore();
15 th.start();
16 sem.wait();
17 while (th.isRunning()) {}
18 destroy(th); // force detach
19 th.join();
20 }