Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (n - p) pthread_atfork(2)
{
pthread_mutex_unlock(&my_mutex);
}
void my_child(void)
{
pthread_mutex_unlock(&my_mutex);
/* Reinitialize state that doesn’t apply...like heap owned */
/* by other threads */
}
{
.
.
.
pthread_atfork(my_prepare, my_parent, my_child);
.
.
fork();
}
NOTES
Do not call pthread_atfork() from within a fork-handler routine. Doing so could cause a
deadlock.
RETURN VALUES
If an error condition occurs, this function returns an integer value indicating the type of error.
Possible return values are:
0 Successful completion.
[ENOMEM] Insufficient table space exists to record the fork-handler routines’ addresses.
RELATED INFORMATION
Functions: pthread_create(2).
STANDARDS CONFORMANCE
Interfaces documented on this reference page conform to the following industry standards:
• IEEE Std 1003.1-2004, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
527186-023 Hewlett-Packard Company 5−31