aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@meta.com>2024-04-19 14:47:42 -0700
committerGitHub <noreply@github.com>2024-04-19 14:47:42 -0700
commit07525c9a85e7fa04db565c6e6e6605ff6099dcb7 (patch)
treeb12112a245641172073d1f1df8212aa082ec8db8 /Python/executor_cases.c.h
parentb45af00bad3449b85c8f54ba7a9474ca1f52de69 (diff)
downloadcpython-07525c9a85e7fa04db565c6e6e6605ff6099dcb7.tar.gz
cpython-07525c9a85e7fa04db565c6e6e6605ff6099dcb7.zip
gh-116818: Make `sys.settrace`, `sys.setprofile`, and monitoring thread-safe (#116775)
Makes sys.settrace, sys.setprofile, and monitoring generally thread-safe. Mostly uses a stop-the-world approach and synchronization around the code object's _co_instrumentation_version. There may be a little bit of extra synchronization around the monitoring data that's required to be TSAN clean.
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index fccff24a418..df87f9178f1 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -21,7 +21,7 @@
_Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
#endif
uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
- uintptr_t version = _PyFrame_GetCode(frame)->_co_instrumentation_version;
+ uintptr_t version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version);
assert((version & _PY_EVAL_EVENTS_MASK) == 0);
if (eval_breaker != version) {
UOP_STAT_INC(uopcode, miss);