mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-33895: Relase GIL while calling functions that acquire Windows loader lock (GH-7789)
LoadLibrary, GetProcAddress, FreeLibrary and GetModuleHandle acquire the system loader lock. Calling these while holding the GIL will cause a deadlock on the rare occasion that another thread is detaching and needs to destroy its thread state at the same time.
This commit is contained in:
parent
2de576e16d
commit
4860f01ac0
8 changed files with 48 additions and 6 deletions
|
@ -127,8 +127,10 @@ initialize_function_pointers(void)
|
|||
closesocket(s);
|
||||
|
||||
/* On WinXP we will have Py_CancelIoEx == NULL */
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
hKernel32 = GetModuleHandle("KERNEL32");
|
||||
*(FARPROC *)&Py_CancelIoEx = GetProcAddress(hKernel32, "CancelIoEx");
|
||||
Py_END_ALLOW_THREADS
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue