pthread_atfork(PTHREAD)
pthread_atfork --
register fork handlers
Synopsis
cc [options] -Kthread file
#include <sys/types.h>
#include <unistd.h>
int pthread_atfork(void (*prepare)(void), void (*parent)(void),
void (*child)(void));
Description
pthread_atfork
declares fork handlers
to be called before and after
fork(S),
in the context of the thread that called
fork.
The
prepare
fork handler is called before
fork
processing commences.
The
parent
fork handle is called after
fork
processing completes in the parent process.
The
child
fork handler is called after
fork
processing completes in the child process.
If no handling is desired at one or more of these three points,
the corresponding fork handler
address(es) may be set to NULL.
The order of calls to
pthread_atfork
is significant.
The
parent
and
child
fork handlers are called in the order
in which they were established by calls to
pthread_atfork.
The
prepare
fork handlers are called in the opposite order.
Return values
Upon successful completion,
pthread_atfork
returns a value of zero.
Otherwise, an error number is returned to indicate the error.
Diagnostics
If the following condition is detected,
pthread_atfork
will return the corresponding value:
ENOMEM-
insufficient table space exists to record the
fork handler addresses
References
atexit(S),
fork(S)
Standards compliance
The Single UNIX Specification, Version 2; The Open Group.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005