diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 18:00:16 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 18:00:16 (GMT) |
| commit | 0f694d72a284ac656772806f09ea9bf454550a98 (patch) | |
| tree | a03227ee8e823b064544415b7a27cb5af35d56e4 /Lib/threading.py | |
| parent | fb0901c96898148bcd47aad2aa3ae59281af3b5a (diff) | |
| parent | dec36b6b74237ddbcbc5ed915591281f3827c271 (diff) | |
| download | cpython-0f694d72a284ac656772806f09ea9bf454550a98.zip cpython-0f694d72a284ac656772806f09ea9bf454550a98.tar.gz cpython-0f694d72a284ac656772806f09ea9bf454550a98.tar.bz2 | |
Merge
Diffstat (limited to 'Lib/threading.py')
| -rw-r--r-- | Lib/threading.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 8d505b7..2362be6 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -1047,21 +1047,18 @@ def _after_fork(): current = current_thread() with _active_limbo_lock: for thread in _active.values(): + # Any lock/condition variable may be currently locked or in an + # invalid state, so we reinitialize them. + thread._reset_internal_locks() if thread is current: # There is only one active thread. We reset the ident to # its new value since it can have changed. ident = get_ident() thread._ident = ident - # Any condition variables hanging off of the active thread may - # be in an invalid state, so we reinitialize them. - thread._reset_internal_locks() new_active[ident] = thread else: # All the others are already stopped. - # We don't call _Thread__stop() because it tries to acquire - # thread._Thread__block which could also have been held while - # we forked. - thread._stopped = True + thread._stop() _limbo.clear() _active.clear() |
