[issue18808] Thread.join returns before PyThreadState is destroyed

Antoine Pitrou report at bugs.python.org
Sun Sep 8 20:18:53 CEST 2013


Antoine Pitrou added the comment:

> Without _stopped, join() can simply wait to acquire _tstate_lock (with
> or without a timeout, and skipping this if _tstate_lock is already
> None).  Etc ;-)  Of course details matter, but it's easy.  I did it
> once, but the tests joining the main thread failed and I put the code
> on hold.

Ah, of course. The main thread needs the event, since the thread state
will only be deleted at the end of Py_Finalize().
The MainThread class could override is_alive() and join(), then.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18808>
_______________________________________


More information about the Python-bugs-list mailing list