Bug in threading.Thread.join() ?

Peter Hansen peter at engcorp.com
Sat Mar 26 07:14:43 EST 2005


Tim Peters wrote:
> [Peter Hansen]
>>If you hit Ctrl-C while the join's wait() is occurring,
>>you'll raise a KeyboardInterrupt and bypass the
>>release() call.

> Then you're doing something other than what you described.  Here on
> WinXP SP2 w/ Python 2.4c2:
[snip]
> I can hit Ctrl+C all day at this point, and nothing (visible) happens.
>  That's because it's sitting in self.__block.wait(), which is in turn
> sitting in waiter.acquire(), and it's simply not possible for Ctrl+C
> to interrupt a mutex acquire.
> 
> As above, I don't know what you're doing.  Maybe you're doing a join()
> with a timeout too?  In that case, I doubt anyone gave any thought to
> what happens if you muck with KeyboardInterrupt too.

Yes, definitely doing this with a timeout value on the join().
Changing your example to do that (join(5), say) pretty
much demonstrates the trouble... in this case a traceback
for KeyboardInterrupt is printed, but the program does not
terminate because of the thread stuck at the __stop()'s
__acquire().

I'll take your last sentence as a form of blessing to go
file a bug report, unless you don't think that's a good idea.

Thanks, Tim!

-Peter



More information about the Python-list mailing list