[issue38106] Race in PyThread_release_lock - can lead to memory corruption and deadlock

Kristján Valur Jónsson report at bugs.python.org
Wed Sep 11 17:57:19 EDT 2019


Kristján Valur Jónsson <sweskman at gmail.com> added the comment:

imho posix made a mistake in allowing signal/broadcast outside the mutex.  Otherwise an implementation could rely on the mutex for internal state manipulation.  I have my own fast condition variable lib implemented using semaphores and it is simple to do if one requires the mutex to be held for the signal event.

Condition variables semantics are otherwise quite brilliant. For example, allowing for spurious wakeups to occur allows, again, for much simpler implementation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38106>
_______________________________________


More information about the Python-bugs-list mailing list