Add issubnormal.
[glibc.git] / nptl / tst-exit3.c
blob9481ed9b420e22c2d37060cb7097c2499f2c5772
1 #include <pthread.h>
2 #include <signal.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <unistd.h>
8 static int do_test (void);
10 #define TEST_FUNCTION do_test ()
11 #include "../test-skeleton.c"
13 static pthread_barrier_t b;
16 static void *
17 tf2 (void *arg)
19 while (1)
20 sleep (100);
22 /* NOTREACHED */
23 return NULL;
27 static void *
28 tf (void *arg)
30 pthread_t th;
32 int e = pthread_barrier_wait (&b);
33 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
35 puts ("barrier_wait failed");
36 exit (1);
39 e = pthread_create (&th, NULL, tf2, NULL);
40 if (e != 0)
42 printf ("create failed: %s\n", strerror (e));
43 exit (1);
46 /* Terminate only this thread. */
47 return NULL;
51 static int
52 do_test (void)
54 pthread_t th;
56 if (pthread_barrier_init (&b, NULL, 2) != 0)
58 puts ("barrier_init failed");
59 exit (1);
62 int e = pthread_create (&th, NULL, tf, NULL);
63 if (e != 0)
65 printf ("create failed: %s\n", strerror (e));
66 exit (1);
69 e = pthread_barrier_wait (&b);
70 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
72 puts ("barrier_wait failed");
73 exit (1);
76 delayed_exit (3);
78 /* Terminate only this thread. */
79 pthread_exit (NULL);
81 /* NOTREACHED */
82 return 1;