[issue8411] Improve condition variable emulation on NT

2010-08-09 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: You wan't to have the Semaphore with a max count of infinite because a) of the "race condition" mentioned (actually, possible discrepancy between n_waiting and actual semaphore value), which can cause the semaphore count to temporarily go positive, and

[issue8411] Improve condition variable emulation on NT

2010-08-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Updated patch file -- Added file: http://bugs.python.org/file18442/nt_cond2.path ___ Python tracker ___

[issue8411] Improve condition variable emulation on NT

2010-08-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: "this is a critical lock" should read "this is a critical moment" :) -- ___ Python tracker ___ _

[issue8411] Improve condition variable emulation on NT

2010-08-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Thanks for your comments. The problem with _cond_timed_wait indicates that the timed wait code hadn't been thoroughly tested at the time of submission. 1) The InterlockedDecrement was left in by mistake. It must be removed 2) The LONG was argument was

[issue8411] Improve condition variable emulation on NT

2010-08-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Oh, and I would call CreateSemaphore() with a max count of 1, precisely to guard us against bugs. -- ___ Python tracker ___ ___

[issue8411] Improve condition variable emulation on NT

2010-08-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Questions: - why does _cond_timed_wait() decrement n_waiting *twice*? - why does _cond_timed_wait() use InterlockedDecrement()? it doesn't protect against regular accesses to the same memory location, since it isn't guarded by the mutex - why don't you simp

[issue8411] Improve condition variable emulation on NT

2010-08-08 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +brian.curtin, tim.golden ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue8411] Improve condition variable emulation on NT

2010-08-06 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: The latter. But I'd really like Antoine to look this over. -- ___ Python tracker ___ ___ Py

[issue8411] Improve condition variable emulation on NT

2010-08-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: This patches ceval_gil.h. Can these changes be unit tested? Or is this intended to be an internal performance, invisible-to-the-user, code improvement? Antoine, are you going to look at this? -- nosy: +terry.reedy stage: -> patch review type: -> perf

[issue8411] Improve condition variable emulation on NT

2010-04-15 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : As per Antoine's suggestion, here is a patch to improve condition variable emulation on windows. By using the windows Semaphore (which hasn't always been available) all of the problems in emulating condition variables using Events disappear. in pa