[New-bugs-announce] [issue8411] Improve condition variable emulation on NT

Kristján Valur Jónsson report at bugs.python.org
Thu Apr 15 22:35:43 CEST 2010

New submission from Kristján Valur Jónsson <kristjan at ccpgames.com>:

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 particular, the "lost wakeup" bug can be elimintated, and the same object easily supports bot the "signal" and "broadcast" mode of waking up threads.  We can also use the CRICITAL_SECTION objects as the associated mutex which is much lighter weight than using a kernel object.

I do think I´ve caught all the corner cases.  It is also simpler to prove because this construct is simpler than the previous one.  If, however, i have missed a spot, I'd be interested to know about it.  Not completely impossible since race conditions are devious beasts.  Ive tested this extensively on Windows.

See also issue 8299 where this implementation was presented.

components: Interpreter Core
files: nt_cond.patch
keywords: needs review, patch, patch
messages: 103251
nosy: krisvale, pitrou
severity: normal
status: open
title: Improve condition variable emulation on NT
versions: Python 3.2
Added file: http://bugs.python.org/file16934/nt_cond.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list