1
/* Test exit of a child of a TCB_EXITING child where the toplevel process starts
2
* waiting on it. The middle one gets detached and strace must update the
3
* toplevel process'es number of attached children to 0.
5
* gcc -o test/childthread test/childthread.c -Wall -ggdb2 -pthread;./strace -f ./test/childthread
6
* It must print: write(1, "OK\n", ...
16
static void *start0 (void *arg)
36
i = pthread_create (&thread0, NULL, start0, NULL);
38
/* The thread must be initialized, it becomes thread-child of this
39
process-child (child of a child of the toplevel process). */
41
/* Here the child TCB cannot be deallocated as there still exist
42
* children (the thread child in START0). */
47
/* We must not be waiting in WAITPID when the child double-exits. */
50
got_pid = waitpid (-1, &status, 0);
51
assert (got_pid == child);
52
assert (WIFEXITED (status));
53
assert (WEXITSTATUS (status) == 42);