xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/testsuite/libphobos.gc/forkgc2.d (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 // { dg-skip-if "test hangs the testsuite PR103944" { *-*-darwin* } }
2 import core.stdc.stdlib : exit;
3 import core.sys.posix.sys.wait : waitpid;
4 import core.sys.posix.unistd : fork;
5 import core.thread : Thread;
6 
main()7 void main()
8 {
9     foreach (t; 0 .. 10)
10         new Thread({
11             foreach (n; 0 .. 100)
12             {
13                 foreach (x; 0 .. 100)
14                     new ubyte[x];
15                 auto f = fork();
16                 assert(f >= 0);
17                 if (f == 0)
18                     exit(0);
19                 else
20                     waitpid(f, null, 0);
21             }
22         }).start();
23 }
24