A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033286.html below:

New syntax threads -- summary wanted)

[Python-Dev] Pre-PEP: with syntax (was: New syntax threads -- summary wanted) [Python-Dev] Pre-PEP: with syntax (was: New syntax threads -- summary wanted)Aahz aahz@pythoncraft.com
Mon, 10 Feb 2003 10:29:52 -0500
On Mon, Feb 10, 2003, Bernhard Herzog wrote:
>
> In the particular case of locks, the threading.Lock object's release
> method must only be called when it's locked (same for the other lock
> objects AFAICT). Seems to me that this would require a flag at the
> python level and then you have the race condition.

That's not a problem for threading.RLock().  You can code that as

    lock = threading.RLock()
    try:
        lock.acquire()
    finally:
        lock.release()

Note that currently there's an AssertionError in threading when you do
that; perhaps that should be changed to a Warning?
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Register for PyCon now!  http://www.python.org/pycon/reg.html



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4