Projet_SETI_RISC-V/riscv-gnu-toolchain/gcc/libphobos/testsuite/libphobos.thread/join_detach.d
2023-03-06 14:48:14 +01:00

20 lines
311 B
D

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();
}