1 /* fork a process that has created a detached thread. */
11 static void *threadmain(void *dummy
)
13 sleep((unsigned long)dummy
);
17 int main(int argc
, char **argv
)
21 pthread_t childthread
;
25 pthread_create(&childthread
, NULL
, threadmain
, (void *)2);
26 pthread_detach(childthread
);
31 pthread_create(&childthread
, NULL
, threadmain
, 0);
32 pthread_join(childthread
, &res
);
36 perror("FAILED: fork failed\n");
43 while (waitpid(childpid
, &status
, 0) != childpid
) {
47 fprintf(stderr
, "FAILED - timeout waiting for child\n");
52 fprintf(stderr
, "PASS\n");