]>
git.saurik.com Git - apple/libpthread.git/blob - tests/atfork.c
5 #include <os/assumes.h>
8 #define DECL_ATFORK(x) \
9 static void prepare_##x(void) { \
10 printf("%d: %s\n", getpid(), __FUNCTION__); \
12 static void parent_##x(void) { \
13 printf("%d: %s\n", getpid(), __FUNCTION__); \
15 static void child_##x(void) { \
16 printf("%d: %s\n", getpid(), __FUNCTION__); \
20 os_assumes_zero(pthread_atfork(prepare_##x, parent_##x, child_##x));
42 int main(int argc
, char *argv
[]) {
68 posix_assumes_zero(pid
);
71 posix_assumes_zero(waitpid(pid
, &status
, 0));
72 posix_assumes_zero(WEXITSTATUS(status
));