[issue4293] Thread Safe Py_AddPendingCall
Antoine Pitrou
report at bugs.python.org
Tue Jan 6 17:06:03 CET 2009
Antoine Pitrou <pitrou at free.fr> added the comment:
Ok, the test patch is fine!
Now looking at the main patch, some comments:
- you removed "volatile" from pendingfirst and pendinglast, is it really
safe?
- what if pending_lock is not initialized when Py_AddPendingCall is
called? I know it's unlikely, but imagine someone calling that function
just after the interpreter has been initialized
- the documentation should mention that the GIL must not be held when
Py_AddPendingCall is called, otherwise there can be a deadlock (is it a
change from previous versions by the way?)
- you should check the return value of PyThread_allocate_lock() for NULL
- is your implementation reentrant? that is, registering a callback from
a callback. There is no need for it to be, but if it aims to be, then it
should perhaps be documented and tested :)
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4293>
_______________________________________
More information about the Python-bugs-list
mailing list