[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation, use Windows native conditional variable

2021-09-27 Thread Eryk Sun
Eryk Sun added the comment: FYI, waiting for a condition variable can cause a thread to enter a wait state that's interruptible, in theory, but the mechanism is different since condition variables and SRW locks are pointer-sized values in user space, instead of NT objects in kernel space. Th

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation, use Windows native conditional variable

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: Eryk: > SleepConditionVariableSRW() can't be interrupted in PyCOND_WAIT() and > PyCOND_TIMEDWAIT(). Oh. A comment on StackOverlow says: "The WaitForXxx functions accept parameters of the generic HANDLE type, which represents a handle to a kernel object

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread Steve Dower
Steve Dower added the comment: > SleepConditionVariableSRW() can't be interrupted in PyCOND_WAIT() and > PyCOND_TIMEDWAIT() This was my immediate reaction as well. Unfortunately, we keep seeing that all waits need to be interruptible, so either a WaitForMultipleObjects or a slow spinlock.

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread Eryk Sun
Eryk Sun added the comment: > IMO it's time to remove _PY_EMULATED_WIN_CV code path from > pycore_condvar.h. SleepConditionVariableSRW() can't be interrupted in PyCOND_WAIT() and PyCOND_TIMEDWAIT(). Maybe a hybrid solution could be adopted. Use native condition variables for the GIL, where

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-29971 "Lock.acquire() not interruptible on Windows". -- ___ Python tracker ___ ___ P

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread STINNER Victor
New submission from STINNER Victor : I recently worked on time.sleep() enhancement (bpo-21302) and threading bugfixes (bpo-45274, bpo-1596321). I saw one more time that Python emulates conditional variables to support Windows XP and older. But Python 3.11 requires Windows 8.1 or newer. IMO it