[issue6721] Locks in python standard library should be sanitized on fork
Richard Oudkerk
report at bugs.python.org
Thu May 31 22:48:42 CEST 2012
Richard Oudkerk <shibturn at gmail.com> added the comment:
Attached is an updated version of Charles-François's reinit_locks.diff.
Changes:
* Handles RLock by assuming that if self->count != 0 when we acquire
the lock, then the lock must have been reinitialized by PyThread_ReInitLocks().
* Applies existing fork tests for Lock to RLock.
* Fixes capitalization issues with PyThread_ReInitLocks()/PyThread_ReinitLocks().
* Defines PyThread_ReInitLocks() to be empty on non-pthread platforms.
Note that RLock._is_owned() is unreliable after a fork until RLock.acquire() has been called.
Also, no synchronization has been added for the list of locks. Are PyThread_allocate_lock() and PyThread_free_lock() supposed to be safe to call while not holding the GIL?
----------
Added file: http://bugs.python.org/file25776/reinit_locks_2.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6721>
_______________________________________
More information about the Python-bugs-list
mailing list