diff options
author | Donghee Na <donghee.na@python.org> | 2023-10-09 23:26:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 23:26:29 (GMT) |
commit | 67e8d416cc5e14c181e4f883ffb4d87f2a647ae1 (patch) | |
tree | 22cc0178e6a705b27f802b2718ef1a57a162428b /Include/internal/pycore_signal.h | |
parent | bdbe43c7d0ad5ebda0232a4ab39689ea79a9733a (diff) | |
download | cpython-67e8d416cc5e14c181e4f883ffb4d87f2a647ae1.zip cpython-67e8d416cc5e14c181e4f883ffb4d87f2a647ae1.tar.gz cpython-67e8d416cc5e14c181e4f883ffb4d87f2a647ae1.tar.bz2 |
gh-109693: Use pyatomic.h for signal module (gh-110480)
Diffstat (limited to 'Include/internal/pycore_signal.h')
-rw-r--r-- | Include/internal/pycore_signal.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Include/internal/pycore_signal.h b/Include/internal/pycore_signal.h index b38b1d3..47213a3 100644 --- a/Include/internal/pycore_signal.h +++ b/Include/internal/pycore_signal.h @@ -10,7 +10,6 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_atomic.h" // _Py_atomic_address #include <signal.h> // NSIG @@ -38,12 +37,10 @@ PyAPI_FUNC(void) _Py_RestoreSignals(void); #define INVALID_FD (-1) struct _signals_runtime_state { - volatile struct { - _Py_atomic_int tripped; - /* func is atomic to ensure that PyErr_SetInterrupt is async-signal-safe - * (even though it would probably be otherwise, anyway). - */ - _Py_atomic_address func; + struct { + // tripped and func should be accessed using atomic ops. + int tripped; + PyObject* func; } handlers[Py_NSIG]; volatile struct { @@ -63,8 +60,9 @@ struct _signals_runtime_state { #endif } wakeup; - /* Speed up sigcheck() when none tripped */ - _Py_atomic_int is_tripped; + /* Speed up sigcheck() when none tripped. + is_tripped should be accessed using atomic ops. */ + int is_tripped; /* These objects necessarily belong to the main interpreter. */ PyObject *default_handler; |