8000 gh-125716: Use A Global Mutex When Initializing Global State For The _interpqueues Module by ericsnowcurrently · Pull Request #125803 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-125716: Use A Global Mutex When Initializing Global State For The _interpqueues Module #125803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 21, 2024
Merged
Prev Previous commit
Next Next commit
Decrement the module count if _globals_init() fails.
  • Loading branch information
ericsnowcurrently committed Oct 21, 2024
commit 9c4c1f2adefebd48afc9243f3b2e15a4cacda48f
1 change: 1 addition & 0 deletions Modules/_interpchannelsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,7 @@ _globals_init(void)
// Called for the first time.
PyThread_type_lock mutex = PyThread_allocate_lock();
if (mutex == NULL) {
_globals.module_count--;
PyMutex_Unlock(&_globals.mutex);
return ERR_CHANNELS_MUTEX_INIT;
}
Expand Down
1 change: 1 addition & 0 deletions Modules/_interpqueuesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ _globals_init(void)
// Called for the first time.
PyThread_type_lock mutex = PyThread_allocate_lock();
if (mutex == NULL) {
_globals.module_count--;
PyMutex_Unlock(&_globals.mutex);
return ERR_QUEUES_ALLOC;
}
Expand Down
0