diff options
Diffstat (limited to 'libphobos/testsuite/libphobos.gc/forkgc2.d')
-rw-r--r-- | libphobos/testsuite/libphobos.gc/forkgc2.d | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libphobos/testsuite/libphobos.gc/forkgc2.d b/libphobos/testsuite/libphobos.gc/forkgc2.d new file mode 100644 index 00000000000..de7796ced72 --- /dev/null +++ b/libphobos/testsuite/libphobos.gc/forkgc2.d @@ -0,0 +1,22 @@ +import core.stdc.stdlib : exit; +import core.sys.posix.sys.wait : waitpid; +import core.sys.posix.unistd : fork; +import core.thread : Thread; + +void main() +{ + foreach (t; 0 .. 10) + new Thread({ + foreach (n; 0 .. 100) + { + foreach (x; 0 .. 100) + new ubyte[x]; + auto f = fork(); + assert(f >= 0); + if (f == 0) + exit(0); + else + waitpid(f, null, 0); + } + }).start(); +} |