summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-02 13:51:37 (GMT)
committerGitHub <noreply@github.com>2020-06-02 13:51:37 (GMT)
commit26881c8fae3b67db3a01d335d3ae7356a29b433e (patch)
tree8cf867af2cd74581dc037a70e0549087d7e39fd3 /Modules/signalmodule.c
parent297257f7bc198e2dc8e0866b539c73ff1a5cc588 (diff)
downloadcpython-26881c8fae3b67db3a01d335d3ae7356a29b433e.zip
cpython-26881c8fae3b67db3a01d335d3ae7356a29b433e.tar.gz
cpython-26881c8fae3b67db3a01d335d3ae7356a29b433e.tar.bz2
PyOS_AfterFork_Child() uses PyStatus (GH-20596)
PyOS_AfterFork_Child() helper functions now return a PyStatus: PyOS_AfterFork_Child() is now responsible to handle errors. * Move _PySignal_AfterFork() to the internal C API * Add #ifdef HAVE_FORK on _PyGILState_Reinit(), _PySignal_AfterFork() and _PyInterpreterState_DeleteExceptMain().
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 6d340a6..24dbd42 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1796,14 +1796,17 @@ PyOS_InterruptOccurred(void)
return 1;
}
+
+#ifdef HAVE_FORK
static void
_clear_pending_signals(void)
{
- int i;
- if (!_Py_atomic_load(&is_tripped))
+ if (!_Py_atomic_load(&is_tripped)) {
return;
+ }
+
_Py_atomic_store(&is_tripped, 0);
- for (i = 1; i < NSIG; ++i) {
+ for (int i = 1; i < NSIG; ++i) {
_Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
}
}
@@ -1816,6 +1819,8 @@ _PySignal_AfterFork(void)
* the interpreter had an opportunity to call the handlers. issue9535. */
_clear_pending_signals();
}
+#endif /* HAVE_FORK */
+
int
_PyOS_IsMainThread(void)