Multithreaded Programming Guide

Exit Print View

Updated: July 2014
 
 

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.

ENOMEM

Description: Insufficient table space exists to record the fork handler addresses.