1 | #include <pthread.h> |
---|---|
2 | #include <signal.h> |
3 | #include <stdio.h> |
4 | #include <string.h> |
5 | #include <unistd.h> |
6 | |
7 | static int do_test (void); |
8 | |
9 | #define TEST_FUNCTION do_test () |
10 | #include "../test-skeleton.c" |
11 | |
12 | static void * |
13 | tf (void *arg) |
14 | { |
15 | while (1) |
16 | sleep (seconds: 100); |
17 | |
18 | /* NOTREACHED */ |
19 | return NULL; |
20 | } |
21 | |
22 | |
23 | static int |
24 | do_test (void) |
25 | { |
26 | pthread_t th; |
27 | |
28 | int e = pthread_create (newthread: &th, NULL, start_routine: tf, NULL); |
29 | if (e != 0) |
30 | { |
31 | printf (format: "create failed: %s\n", strerror (errnum: e)); |
32 | return 1; |
33 | } |
34 | |
35 | delayed_exit (seconds: 1); |
36 | |
37 | /* Terminate only this thread. */ |
38 | pthread_exit (NULL); |
39 | |
40 | /* NOTREACHED */ |
41 | return 1; |
42 | } |
43 |