GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
PTHREAD_ATFORK(3) FreeBSD Library Functions Manual PTHREAD_ATFORK(3)

pthread_atfork
register fork handlers

POSIX Threads Library (libpthread, -lpthread)

#include <pthread.h>

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

The pthread_atfork() function declares fork handlers to be called before and after fork(2), in the context of the thread that called fork(2).

The handlers registered with pthread_atfork() are called at the moments in time described below:

prepare
Before fork(2) processing commences in the parent process. If more than one prepare handler is registered they will be called in the opposite order they were registered.
parent
After fork(2) completes in the parent process. If more than one parent handler is registered they will be called in the same order they were registered.
child
After fork(2) processing completes in the child process. If more than one child handler is registered they will be called in the same order they were registered.

If no handling is desired at one or more of these three points, a null pointer may be passed as the corresponding fork handler.

If successful, the pthread_atfork() function will return zero. Otherwise an error number will be returned to indicate the error.

The pthread_atfork() function will fail if:
[]
Insufficient table space exists to record the fork handler addresses.

fork(2), pthread(3)

The pthread_atfork() function is expected to conform to IEEE Std 1003.1 (“POSIX.1”).

This manpage was written by Alex Vasylenko <lxv@omut.org>.
June 21, 2004 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.