Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-104530: Use native Win32 condition variables#104531
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ericsnowcurrently commentedFeb 1, 2024
I'll defer to@zooba and other Windows experts on this one. |
zooba commentedFeb 1, 2024
I definitely want the fixes in this PR, even if we don't change the default setting for CVs. My main concern is destabilising things -@encukou has just spent days tracking down a Windows deadlock, and I'd hate to give him a whole lot of new ones ;) But let's see what the buildbots say |
bedevere-bot commentedFeb 1, 2024
encukou commentedFeb 2, 2024
Eh, I think there are more deadlocks waiting to be solved even without this PR. |
zooba commentedFeb 2, 2024
Alright, let's YOLO it 😆 Easy enough to change the setting to disable later on if it turns out to be trouble, but alphas are definitely the time to turn it on. |
Uh oh!
There was an error while loading.Please reload this page.
Update Python to using native Win32 condition variable support, by setting
_PY_EMULATED_WIN_CVto0.A small fix to
PyCOND_TIMEDWAIT()was required to correctly report condition variable timeouts.After doing this, I found that
_listdir_windows_no_opendir()was crashing becausePy_END_ALLOW_THREADSis overwriting Win32's GLE and the error codeERROR_NO_MORE_FILESfromFindNextFileW()was being wiped out:I debugged this (using iDNA/TTD) and found that
SleepConditionVariableSRW()was clearing the Win32 GLE inPy_END_ALLOW_THREADS:I have fixed this by adding code to
PyEval_RestoreThreadto save and restore the Win32 GLE, and removing the code inPyThread_tss_get()andPyThread_get_key_value()that does the same (as it's no longer required).cc:@ericsnowcurrently