]>
git.saurik.com Git - apple/libc.git/blob - pthreads/tests/pthread_atfork_test.c
7 * Parent and child handlers are called in the order they were registered
8 * prepare handlers are called in reverse order. The non-commutative
9 * operations will ensure that we are calling them in the proper order.
12 static int parentval
= 0;
13 static int childval
= 0;
15 static void prepare1(void)
20 static void prepare2(void)
25 static void parent1(void)
30 static void parent2(void)
35 static void child1(void)
40 static void child2(void)
51 assert(!pthread_atfork(prepare1
, parent1
, child1
));
52 assert(!pthread_atfork(prepare2
, parent2
, child2
));
58 child
= waitpid(pid
, &status
, 0);
60 assert(WIFEXITED(status
));
61 assert(WEXITSTATUS(status
) == 15);
62 assert(parentval
== 30);