Query: pthread_atfork
OS: mojave
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
PTHREAD_ATFORK(3) BSD Library Functions Manual PTHREAD_ATFORK(3)NAMEpthread_atfork -- register handlers to be called before and after fork()SYNOPSIS#include <pthread.h> int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));DESCRIPTIONThe pthread_atfork() function declares fork handlers to be called before and after fork(2), in the context of the thread that called fork(2). The handlers registered with pthread_atfork() are called at the moments in time described below: prepare Before fork(2) processing commences in the parent process. If more than one prepare handler is registered they will be called in the opposite order they were registered. parent After fork(2) completes in the parent process. If more than one parent handler is registered they will be called in the same order they were registered. child After fork(2) processing completes in the child process. If more than one child handler is registered they will be called in the same order they were registered. If no handling is desired at one or more of these three points, a null pointer may be passed as the corresponding fork handler. Important: only async-signal-safe functions are allowed on the child side of fork(). See sigaction(2) for details.RETURN VALUESIf successful, the pthread_atfork() function will return zero. Otherwise an error number will be returned to indicate the error.ERRORSThe pthread_atfork() function will fail if: [ENOMEM] The system lacked the necessary resources to add another handler to the list.SEE ALSOfork(2), pthread(3)STANDARDSThe pthread_atfork() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').BSDJune 21, 2004 BSD
Related Man Pages |
---|
pthread_atfork(3) - redhat |
pthread_atfork(3) - opendarwin |
pthread_atfork(3) - plan9 |
pthread_atfork(3) - php |
pthread_atfork(3) - ultrix |
Similar Topics in the Unix Linux Community |
---|
Trouble with using fork() |
A small question about fork() |
help in C of fork() problem |
Timed action after fork() in parent process |
question about fork |