summaryrefslogtreecommitdiff
path: root/libphobos/testsuite/libphobos.thread/join_detach.d
blob: f1515190171f022ec170bb159b077cd614ac4168 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import core.thread;
import core.sync.semaphore;

__gshared Semaphore sem;

void thread_main ()
{
    sem.notify();
}

void main()
{
    auto th = new Thread(&thread_main);
    sem = new Semaphore();
    th.start();
    sem.wait();
    while (th.isRunning()) {}
    destroy(th); // force detach
    th.join();
}