Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_atfork.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_atfork.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_atfork.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_atfork.html on line 8

pthread_atfork()

Register fork handlers

Synopsis:

#include <process.h>

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

Arguments:

prepare
NULL, or a pointer to the handler to call before the fork.
parent
NULL, or a pointer to the handler to call after the fork in the parent process.
child
NULL, or a pointer to the handler to call after the fork in the child process.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_atfork() function registers fork handler functions to be called before and after a fork(), in the context of the thread that called fork(). You can set one or more of the arguments to NULL to indicate no handler.

You can register multiple prepare, parent, and child fork handlers, by making additional calls to pthread_atfork(). In this case, the parent and child handlers are called in the order they were registered, and the prepare handlers are called in the reverse order.


Note:

You can't use the pthread_atfork() function for useful purposes as the C library doesn't have the necessary handlers. It also implies that Neutrino currently doesn't support fork() in multi-threaded programs.


Returns:

EOK
Success.
ENOMEM
Insufficient memory to record fork handlers.

Classification:

POSIX 1003.1 THR

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

atexit(), fork()

Processes and Threads chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_atfork.html on line 159

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_atfork.html on line 159