9 static pthread_key_t keys[NKEYS];
10 static pthread_barrier_t b;
17 for (int i = 0; i < NKEYS; ++i)
19 void *p = pthread_getspecific (keys[i]);
20 pthread_setspecific (keys[i], (void *) 7);
26 pthread_barrier_wait (arg);
27 pthread_barrier_wait (arg);
36 pthread_barrier_init (&b, NULL, 2);
38 for (int i = 0; i < NKEYS; ++i)
39 if (pthread_key_create (&keys[i], NULL) != 0)
41 puts ("cannot create keys");
46 if (pthread_create (&th, NULL, tf, &b) != 0)
48 puts ("cannot create thread in parent");
52 pthread_barrier_wait (&b);
57 if (pthread_create (&th, NULL, tf, NULL) != 0)
59 puts ("cannot create thread in child");
64 pthread_join (th, &res);
70 puts ("cannot create child process");
75 if (TEMP_FAILURE_RETRY (waitpid (pid, &s, 0)) != pid)
77 puts ("failing to wait for child process");
81 pthread_barrier_wait (&b);
82 pthread_join (th, NULL);
84 return !WIFEXITED (s) ? 2 : WEXITSTATUS (s);
88 #define TEST_FUNCTION do_test ()
89 #include "../test-skeleton.c"