summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@meta.com>2024-04-19 21:47:42 (GMT)
committerGitHub <noreply@github.com>2024-04-19 21:47:42 (GMT)
commit07525c9a85e7fa04db565c6e6e6605ff6099dcb7 (patch)
treeb12112a245641172073d1f1df8212aa082ec8db8 /Python/pystate.c
parentb45af00bad3449b85c8f54ba7a9474ca1f52de69 (diff)
downloadcpython-07525c9a85e7fa04db565c6e6e6605ff6099dcb7.zip
cpython-07525c9a85e7fa04db565c6e6e6605ff6099dcb7.tar.gz
cpython-07525c9a85e7fa04db565c6e6e6605ff6099dcb7.tar.bz2
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/pystate.c')
-rw-r--r--Python/pystate.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 37480df..06806bd 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -399,6 +399,7 @@ _Py_COMP_DIAG_POP
&(runtime)->unicode_state.ids.mutex, \
&(runtime)->imports.extensions.mutex, \
&(runtime)->ceval.pending_mainthread.mutex, \
+ &(runtime)->ceval.sys_trace_profile_mutex, \
&(runtime)->atexit.mutex, \
&(runtime)->audit_hooks.mutex, \
&(runtime)->allocators.mutex, \