Skip gcc.dg/analyzer/pr94688.c on hppa*64*-*-*
[official-gcc.git] / libphobos / testsuite / libphobos.gc / sigmaskgc.d
blobeb46316d18f3fb803820e589200c5066ebc2a171
2 // https://issues.dlang.org/show_bug.cgi?id=20256
4 extern(C) __gshared string[] rt_options = [ "gcopt=parallel:1" ];
6 void main()
8 version (Posix)
10 import core.sys.posix.signal;
11 import core.sys.posix.unistd;
12 import core.thread;
13 import core.memory;
15 sigset_t m;
16 sigemptyset(&m);
17 sigaddset(&m, SIGHUP);
19 auto x = new int[](10000);
20 foreach (i; 0 .. 10000)
22 x ~= i;
24 GC.collect(); // GC create thread
26 sigprocmask(SIG_BLOCK, &m, null); // block SIGHUP from delivery to main thread
28 auto parent_pid = getpid();
29 auto child_pid = fork();
30 assert(child_pid >= 0);
31 if (child_pid == 0)
33 kill(parent_pid, SIGHUP); // send signal to parent
34 _exit(0);
36 // parent
37 Thread.sleep(100.msecs);
38 // if we are here, then GC threads didn't receive SIGHUP,
39 // otherwise whole process killed
40 _exit(0);