When I use fork I am getting a core.thread.ThreadException: Unable to load thread state exception.
This is dmd 2.047 on OS X I am trying to convert a small C application. module fork; import core.sys.posix.unistd, std.stdio; void main() { auto pid = fork(); if( pid > 0 ) { writeln( "Parent" ); } else if( pid == 0 ) { writeln( "Child" ); } else { writeln( "Failed to fork!" ); } } $ ./fork Parent Child core.thread.ThreadException: Unable to load thread state ---------------- 5 fork 0x00006de9 thread_suspendAll + 85 6 fork 0x0000aff0 D2gc3gcx3Gcx11fullcollectMFPvZk + 32 7 fork 0x0000afbd D2gc3gcx3Gcx16fullcollectshellMFZk + 41 8 fork 0x0000a0a2 D2gc3gcx2GC18fullCollectNoStackMFZv + 54 9 fork 0x0000803c gc_term + 44 10 fork 0x0000cef6 D2rt6dmain24mainUiPPaZi6runAllMFZv + 90 11 fork 0x0000cdc6 D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 42 12 fork 0x0000cd54 main + 168 13 fork 0x00001a85 start + 53 I tried different flags but the output is the same.