Bugs item #1171023, was opened at 2005-03-26 09:40 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1171023&group_id=5470
Category: Threads Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Peter Hansen (phansen) Assigned to: Nobody/Anonymous (nobody) Summary: Thread.join() fails to release Lock on KeyboardInterrupt Initial Comment: In threading.Thread.join(), the Condition/Lock object called self.__block is acquired upon entry, and released on exit without an enclosing try/finally to ensure that the release really occurs. If the join() call has no timeout, the wait() call that occurs inside can never be interrupted so there is no problem. If the join() call has a timeout, however, the wait() occurs in a loop which can be interrupted by a Ctrl-C, raising a KeyboardInterrupt which skips the self.__block.release() call and leaves the Lock acquired. This is a problem if the main thread (which is the only one that will see a KeyboardInterrupt) is the one calling join() and only if the other thread on which the join() is being called is a non-daemon thread or, in the case of a daemon thread, if the main thread subsequently attempts to wait for the other thread to terminate (for example, by monitoring isAlive() on the other thread). In any event, the lack of a try/finally means the joined thread will never really finish because any attempt by it to call its __stop() method will block forever. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1171023&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com