![]() |
![]() |
![]() |
Register fork handlers
#include <process.h> int pthread_atfork( void (*prepare)(void), void (*parent)(void), void (*child)(void) );
libc
The pthread_atfork() function registers fork handler functions to be called before and after a fork(), in the context of the thread that called fork(). The prepare fork handler is called before the fork, the parent fork handler is called after the fork in the parent process, and the child fork handler is called after the fork in the child process. One or more of the arguments may be set to NULL to indicate no handler.
Multiple prepare, parent and child fork handlers may be registered by repeated calls to pthread_atfork(). In this case the parent and child handlers are called in the order they were registered, and the prepare handlers are called in the reverse order.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
![]() |
![]() |
![]() |