[Patches] [ python-Patches-1314396 ] ensure lock is released if exception is raised
SourceForge.net
noreply at sourceforge.net
Wed Nov 23 03:22:06 CET 2005
Patches item #1314396, was opened at 2005-10-05 19:18
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1314396&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Eric Blossom (eblossom)
>Assigned to: Brett Cannon (bcannon)
Summary: ensure lock is released if exception is raised
Initial Comment:
If an exception (typically KeyboardInterrupt) is raised
in Thread.join, self.__block will be left locked, and
any later attempt to join will block forever. The bug
is easy to trigger if you provide a timeout to join.
This patch ensures that the lock is released.
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2005-11-22 18:22
Message:
Logged In: YES
user_id=357491
rev. 41524 (2.5) and rev. 41525 (2.4) have the fix. I am
really looking forward to the 'with' statement and having
all of the locks in 'threading' support it. Then this kind
of thing will be avoided.
Also, so it is documented, to trigger this, do the following::
import threading
import time
th = threading.Thread(target=lambda: time.sleep(5.0))
th.start()
th.join('blah')
th.join # Used to hang
Thanks, Eric (tacked you on to Misc/ACKS).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1314396&group_id=5470
More information about the Patches
mailing list