Multithreaded Programming Guide

Forking Safely

See the discussion about pthread_atfork(3C) in Solution: pthread_atfork.

pthread_atfork Syntax

int pthread_atfork(void (*prepare) (void), void (*parent) (void),
    void (*child) (void) );

pthread_atfork Return Values

pthread_atfork() returns zero when the call completes successfully. Any other return value indicates that an error occurred. When the following condition occurs, pthread_atfork() fails and returns the corresponding value.



Insufficient table space exists to record the fork handler addresses.