• Tim Peters's avatar
    Issue 18984: Remove ._stopped Event from Thread internals. · c363a23e
    Tim Peters yazdı
    The fix for issue 18808 left us checking two things to be sure a Thread
    was done:  an Event (._stopped) and a mutex (._tstate_lock).  Clumsy &
    brittle.  This patch removes the Event, leaving just a happy lock :-)
    
    The bulk of the patch removes two excruciating tests, which were
    verifying sanity of the internals of the ._stopped Event after a fork.
    Thanks to Antoine Pitrou for verifying that's the only real value
    these tests had.
    
    One consequence of moving from an Event to a mutex:  waiters (threads
    calling Thread.join()) used to block each on their own unique mutex
    (internal to the ._stopped event), but now all contend on the same
    mutex (._tstate_lock).  These approaches have different performance
    characteristics on different platforms.  I don't think it matters in
    this context.
    c363a23e
threading.py 32.6 KB