aboutsummaryrefslogtreecommitdiff
path: root/libphobos/testsuite/libphobos.gc/forkgc2.d
blob: 38d0d0c2f93e546152205c1340ca655b16c412f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-skip-if "test hangs the testsuite PR103944" { *-*-darwin* } }
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();
}