[Python-Dev] Threading idea -- exposing a global thread lock

Barry Warsaw barry at python.org
Tue Mar 14 06:08:45 CET 2006


On Mon, 2006-03-13 at 23:06 -0500, Phillip J. Eby wrote:

> +1 on the idea, -1000 on the name.  It's neither atomic nor a 
> transaction.  I believe that "critical section" is a more common term for 
> what you're proposing.
> 
> Probably the primitive could be placed in the thread or threading module, 
> so that it would be something like:
> 
>      with threading.critical_section():
>          # ...

Or even <shudder> threading.synchronized().  But in any event, +1 on the
idea and on sticking the primitive in threading.

> It might be nice to be able to escape out of the critical section using a 
> nested with: statement, as this would allow you to treat much of a program 
> as single-threaded, and then selectively allow task switching.  But I'm not 
> sure what you'd call that API.  :)

threading.unsynchronize()?  Yikes.
-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20060314/715a3fb8/attachment.pgp 


More information about the Python-Dev mailing list