summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/sys.rst
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-05-27 15:50:54 (GMT)
committerGitHub <noreply@github.com>2017-05-27 15:50:54 (GMT)
commit346cbd351ee0dd3ab9cb9f0e4cb625556707877e (patch)
tree8590c5fc85acf57750ecb8d07a407a3dbe233f85 /Doc/c-api/sys.rst
parentf931fd1c2ad969db72460d3ab41e3d1a4a62c371 (diff)
downloadcpython-346cbd351ee0dd3ab9cb9f0e4cb625556707877e.zip
cpython-346cbd351ee0dd3ab9cb9f0e4cb625556707877e.tar.gz
cpython-346cbd351ee0dd3ab9cb9f0e4cb625556707877e.tar.bz2
bpo-16500: Allow registering at-fork handlers (#1715)
* bpo-16500: Allow registering at-fork handlers * Address Serhiy's comments * Add doc for new C API * Add doc for new Python-facing function * Add NEWS entry + doc nit
Diffstat (limited to 'Doc/c-api/sys.rst')
-rw-r--r--Doc/c-api/sys.rst39
1 files changed, 39 insertions, 0 deletions
diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
index bc00aa1..c6777d6 100644
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -26,6 +26,42 @@ Operating System Utilities
one of the strings ``'<stdin>'`` or ``'???'``.
+.. c:function:: void PyOS_BeforeFork()
+
+ Function to prepare some internal state before a process fork. This
+ should be called before calling :c:func:`fork` or any similar function
+ that clones the current process.
+ Only available on systems where :c:func:`fork` is defined.
+
+ .. versionadded:: 3.7
+
+
+.. c:function:: void PyOS_AfterFork_Parent()
+
+ Function to update some internal state after a process fork. This
+ should be called from the parent process after calling :c:func:`fork`
+ or any similar function that clones the current process, regardless
+ of whether process cloning was successful.
+ Only available on systems where :c:func:`fork` is defined.
+
+ .. versionadded:: 3.7
+
+
+.. c:function:: void PyOS_AfterFork_Child()
+
+ Function to update some internal state after a process fork. This
+ should be called from the child process after calling :c:func:`fork`
+ or any similar function that clones the current process.
+ Only available on systems where :c:func:`fork` is defined.
+
+ .. versionadded:: 3.7
+
+ .. seealso::
+ :func:`os.register_at_fork` allows registering custom Python functions
+ to be called by :c:func:`PyOS_BeforeFork()`,
+ :c:func:`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`.
+
+
.. c:function:: void PyOS_AfterFork()
Function to update some internal state after a process fork; this should be
@@ -33,6 +69,9 @@ Operating System Utilities
If a new executable is loaded into the new process, this function does not need
to be called.
+ .. deprecated:: 3.7
+ This function is superseded by :c:func:`PyOS_AfterFork_Child()`.
+
.. c:function:: int PyOS_CheckStack()