[Python-Dev] Software Transactional Memory for Python (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sat Aug 27 16:47:17 CEST 2011


On Sat, 27 Aug 2011 15:08:36 +0200 Armin Rigo <arigo at tunes.org> wrote:

Hi Nick,

On Sat, Aug 27, 2011 at 2:40 PM, Nick Coghlan <ncoghlan at gmail.com> wrote: > 1. How does the patch interact with C code that explicitly releases > the GIL? (e.g. IO commands inside a "with atomic:" block) As implemented, any code in a "with atomic" is prevented from explicitly releasing and reacquiring the GIL: the GIL remain acquired until the end of the "with" block. In other words PyBEGINALLOWTHREADS has no effect in a "with" block.

You then risk deadlocks. Say:

Lock L could simply be the lock used by the file object (a Buffered{Reader,Writer,Random}) which thread B is reading or writing from.

Regards

Antoine.



More information about the Python-Dev mailing list