mc_translate.c: enable further uses of DLexpensive for scalar EQ/NE comparisons
[valgrind.git] / none / tests / pth_2sig.c
blob56e6904c0139a4bcb616e4e977fdaf04538d6086
1 #include <pthread.h>
2 #include <signal.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include <unistd.h>
7 #include <sys/wait.h>
9 void *slavethread(void *arg)
11 while (1)
12 pause();
15 int main(int argc, char **argv)
17 int i;
18 for (i = 0; i < 10; i++) {
19 pthread_t slave;
20 if (pthread_create(&slave, 0, slavethread, 0)) {
21 perror("pthread_create");
22 exit(2);
26 pid_t pid = getpid();
27 switch (fork()) {
28 case 0: // child
29 sleep(2); // Should be enough to ensure (some) threads are created
30 for (i = 0; i < 20 && kill(pid, SIGTERM) == 0; i++)
32 exit(0);
33 case -1:
34 perror("fork");
35 exit(4);
38 while (1)
39 pause();
40 fprintf(stderr, "strange, this program is supposed to be killed!\n");
41 return 1;