summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 46878c7..57dc4a1 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -451,15 +451,9 @@ PySys_AddAuditHook(Py_AuditHookFunction hook, void *userData)
e->hookCFunction = (Py_AuditHookFunction)hook;
e->userData = userData;
- if (runtime->audit_hooks.mutex == NULL) {
- /* The runtime must not be initialized yet. */
- add_audit_hook_entry_unlocked(runtime, e);
- }
- else {
- PyThread_acquire_lock(runtime->audit_hooks.mutex, WAIT_LOCK);
- add_audit_hook_entry_unlocked(runtime, e);
- PyThread_release_lock(runtime->audit_hooks.mutex);
- }
+ PyMutex_Lock(&runtime->audit_hooks.mutex);
+ add_audit_hook_entry_unlocked(runtime, e);
+ PyMutex_Unlock(&runtime->audit_hooks.mutex);
return 0;
}