summaryrefslogtreecommitdiffstats
path: root/man3/pthread_atfork.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/pthread_atfork.3')
-rw-r--r--man3/pthread_atfork.328
1 files changed, 14 insertions, 14 deletions
diff --git a/man3/pthread_atfork.3 b/man3/pthread_atfork.3
index a1226cfa4..91c711938 100644
--- a/man3/pthread_atfork.3
+++ b/man3/pthread_atfork.3
@@ -19,31 +19,31 @@ POSIX threads library
The
.BR pthread_atfork ()
function registers fork handlers that are to be executed when
-.BR fork (2)
+.MR fork 2
is called by any thread in a process.
The handlers are executed in the context of the thread that calls
-.BR fork (2).
+.MR fork 2 .
.P
Three kinds of handler can be registered:
.IP \[bu] 3
.I prepare
specifies a handler that is executed in the parent process before
-.BR fork (2)
+.MR fork 2
processing starts.
.IP \[bu]
.I parent
specifies a handler that is executed in the parent process after
-.BR fork (2)
+.MR fork 2
processing completes.
.IP \[bu]
.I child
specifies a handler that is executed in the child process after
-.BR fork (2)
+.MR fork 2
processing completes.
.P
Any of the three arguments may be NULL if no handler is needed
in the corresponding phase of
-.BR fork (2)
+.MR fork 2
processing.
.SH RETURN VALUE
On success,
@@ -70,14 +70,14 @@ POSIX.1-2008.
POSIX.1-2001.
.SH NOTES
When
-.BR fork (2)
+.MR fork 2
is called in a multithreaded process,
only the calling thread is duplicated in the child process.
The original intention of
.BR pthread_atfork ()
was to allow the child process to be returned to a consistent state.
For example, at the time of the call to
-.BR fork (2),
+.MR fork 2 ,
other threads may have locked mutexes that are visible in the
user-space memory duplicated in the child.
Such mutexes would never be unlocked,
@@ -90,12 +90,12 @@ restored to a consistent state.
In practice, this task is generally too difficult to be practicable.
.P
After a
-.BR fork (2)
+.MR fork 2
in a multithreaded process returns in the child,
the child should call only async-signal-safe functions (see
-.BR signal\-safety (7))
+.MR signal\-safety 7 )
until such time as it calls
-.BR execve (2)
+.MR execve 2
to execute a new program.
.P
POSIX.1 specifies that
@@ -103,6 +103,6 @@ POSIX.1 specifies that
shall not fail with the error
.BR EINTR .
.SH SEE ALSO
-.BR fork (2),
-.BR atexit (3),
-.BR pthreads (7)
+.MR fork 2 ,
+.MR atexit 3 ,
+.MR pthreads 7