pthread_atfork_unregister_np Subroutine`
Purpose
Unregisters fork handlers.Library
Threads Library (libpthreads.a).
Syntax
#include <sys/types.h>
#include <unistd.h>
int pthread_atfork_unregister_np (arg, prepare, parent, child, flags)
void *arg;
void (*prepare)();
void (*parent)();
void (*child)();
int flags;
Description
The pthread_atfork_unregister_np subroutine unregisters functions for pre and post fork handling. The fork handlers must be previously registered using either the pthread_atfork or the pthread_atfork_np subroutine.
The flags parameter determines what handlers are unregistered. It could be any of the following :
- 0
- The first POSIX handler that matches will be unregistered.
- PTHREAD_ATFORK_ALL
- All POSIX duplicate handlers that match and all non- portable handlers that differ only in argument value will be unregistered.
- PTHREAD_ATFORK_ARGUMENT
- The first non-portable handler that matches will be unregistered.
The above flags may be combined using the bitwise OR operation. , The flags value of PTHREAD_ATFORK_ARGUMENT | PTHREAD_ATFORK_ALL would cause all non-portable duplicate handlers that match to be unregistered.
Note:
- The pthread.h header file must be the first included file of each source file using the threads library.
- The pthread_atfork_unregister_np subroutine is not portable.
- The handlers that take parameter are non-portable.
- The handlers that do not take parameter are POSIX compliant and are referred to as POSIX handlers.
Paramaters
- arg
- Points to the parameter to be passed to the fork cleanup handlers. If the handlers do not take parameter , the value of this pointer should be set to NULL.
- prepare
- The pre-fork cleanup handler.
- parent
- The parent post-fork cleanup handler.
- child
- The child post-fork cleanup handler.
- flags
- Defines what handlers are to be unregistered.
Return Values
Upon successful completion, the pthread_atfork_unregister_np subroutine returns a value of zero. Otherwise, an error number is returned to indicate the error.
Error Codes
- EINVAL
- Arguments do not identify a fork handler.