[issue4751] Patch for better thread support in hashlib

Antoine Pitrou report at bugs.python.org
Thu Jan 1 01:04:30 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

Actually, your code can deadlock since ENTER_HASHLIB doesn't release the
GIL. Think about it:

// Thread A is here, holding the GIL and waiting for self->lock to be 
// released by thread B
ENTER_HASHLIB(self)
Py_BEGIN_ALLOW_THREADS
// Thread B is here, holding self->lock and waiting for the GIL to be
// released by thread A
Py_END_ALLOW_THREADS
LEAVE_HASHLIB(self)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4751>
_______________________________________


More information about the Python-bugs-list mailing list