]> sourceware.org Git - glibc.git/blame - nptl/tst-exit3.c
Fix inet_network("1 bar"). Fixes bug 15277.
[glibc.git] / nptl / tst-exit3.c
CommitLineData
ed2ced8a
UD
1#include <pthread.h>
2#include <signal.h>
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6#include <unistd.h>
7
8
9static pthread_barrier_t b;
10
11
12static void *
13tf2 (void *arg)
14{
15 while (1)
16 sleep (100);
17
18 /* NOTREACHED */
19 return NULL;
20}
21
22
23static void *
24tf (void *arg)
25{
26 pthread_t th;
27
28 int e = pthread_barrier_wait (&b);
29 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
30 {
31 puts ("barrier_wait failed");
32 exit (1);
33 }
34
35 e = pthread_create (&th, NULL, tf2, NULL);
36 if (e != 0)
37 {
38 printf ("create failed: %s\n", strerror (e));
39 exit (1);
40 }
41
42 /* Terminate only this thread. */
43 return NULL;
44}
45
46
47static int
48do_test (void)
49{
50 pthread_t th;
51
52 if (pthread_barrier_init (&b, NULL, 2) != 0)
53 {
54 puts ("barrier_init failed");
55 exit (1);
56 }
57
58 int e = pthread_create (&th, NULL, tf, NULL);
59 if (e != 0)
60 {
61 printf ("create failed: %s\n", strerror (e));
62 exit (1);
63 }
64
65 e = pthread_barrier_wait (&b);
66 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
67 {
68 puts ("barrier_wait failed");
69 exit (1);
70 }
71
72 /* Terminate only this thread. */
73 pthread_exit (NULL);
74
75 /* NOTREACHED */
76 return 1;
77}
78
79#define EXPECTED_SIGNAL SIGALRM
80#define TEST_FUNCTION do_test ()
81#include "../test-skeleton.c"
This page took 0.224495 seconds and 5 git commands to generate.