Debian Codegraph @

libphobos/testsuite/libphobos.gc/startbackgc.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=20270
2 import core.sys.posix.sys.wait : waitpid;
3 import core.sys.posix.unistd : fork, _exit;
4 import core.thread : Thread;
5
6 void main()
7 {
8 foreach (t; 0 .. 10)
9 new Thread({
10 foreach (n; 0 .. 100)
11 {
12 foreach (x; 0 .. 100)
13 new ubyte[x];
14 auto f = fork();
15 assert(f >= 0);
16 if (f == 0)
17 _exit(0);
18 else
19 waitpid(f, null, 0);
20 }
21 }).start();
22 }