Index of Section 2 Manual Pages

Interix / SUApthread_atfork.2Interix / SUA

pthread_atfork(2)                                     pthread_atfork(2)

  pthread_atfork()

  NAME

    pthread_atfork() - set fork handlers

  SYNOPSIS

    #include 

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

  DESCRIPTION

    The pthread_atfork(2) function specifies the fork handlers that are to be
    called before and after a call to fork(2). The function specified by
    prepare is called before the processing done by fork() actually begins.
    The function specified by parent is called after the fork() processing
    completes in the parent process, while the function specified by child is
    called after the fork() processing completes in the resulting child
    process. The fork handlers are called in the context of the process that
    called fork(). Any or all of these three addresses can be set to NULL if
    the corresponding fork handler is not required.

    The fork handlers can be chained. The parent and child handlers are called
    in the order in which they were registered by subsequent calls to
    pthread_atfork(), while the prepare handlers are called in the reverse
    order in which they were registered.

  RETURN VALUES

    On success, the pthread_atfork() function returns 0; otherwise, it returns
    an error number.

  ERRORS

    The pthread_attr() can fail for the following reason:

    [ENOMEM]
        Not enough free memory to hold the fork handler addresses.

    This function does not return [EINTR].

  SEE ALSO

    atexit(3)

    fork(2)

  USAGE NOTES

    The pthread_atfork function is thread safe.

    The pthread_atfork function is not async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA