Add bug 18604 to the correct section
[glibc.git] / nptl / tst-exit3.c
blobda92c82c0e9e21c8429582362ba12114e8386c41
1 #include <pthread.h>
2 #include <signal.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <unistd.h>
9 static pthread_barrier_t b;
12 static void *
13 tf2 (void *arg)
15 while (1)
16 sleep (100);
18 /* NOTREACHED */
19 return NULL;
23 static void *
24 tf (void *arg)
26 pthread_t th;
28 int e = pthread_barrier_wait (&b);
29 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
31 puts ("barrier_wait failed");
32 exit (1);
35 e = pthread_create (&th, NULL, tf2, NULL);
36 if (e != 0)
38 printf ("create failed: %s\n", strerror (e));
39 exit (1);
42 /* Terminate only this thread. */
43 return NULL;
47 static int
48 do_test (void)
50 pthread_t th;
52 if (pthread_barrier_init (&b, NULL, 2) != 0)
54 puts ("barrier_init failed");
55 exit (1);
58 int e = pthread_create (&th, NULL, tf, NULL);
59 if (e != 0)
61 printf ("create failed: %s\n", strerror (e));
62 exit (1);
65 e = pthread_barrier_wait (&b);
66 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
68 puts ("barrier_wait failed");
69 exit (1);
72 /* Terminate only this thread. */
73 pthread_exit (NULL);
75 /* NOTREACHED */
76 return 1;
79 #define EXPECTED_SIGNAL SIGALRM
80 #define TEST_FUNCTION do_test ()
81 #include "../test-skeleton.c"