Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d999c349
Commit
d999c349
authored
Oct 04, 2014
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#11866: Eliminate race condition in the computation of names for new threads.
Original patch by Peter Saveliev.
parent
429866d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
Lib/threading.py
Lib/threading.py
+4
-4
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/threading.py
View file @
d999c349
...
...
@@ -11,6 +11,7 @@ except ImportError:
import
warnings
from
collections
import
deque
as
_deque
from
itertools
import
count
as
_count
from
time
import
time
as
_time
,
sleep
as
_sleep
from
traceback
import
format_exc
as
_format_exc
...
...
@@ -623,11 +624,10 @@ class _Event(_Verbose):
self
.
__cond
.
release
()
# Helper to generate new thread names
_counter
=
0
_counter
=
_count
().
next
_counter
()
# Consume 0 so first non-main thread has id 1.
def
_newname
(
template
=
"Thread-%d"
):
global
_counter
_counter
=
_counter
+
1
return
template
%
_counter
return
template
%
_counter
()
# Active thread administration
_active_limbo_lock
=
_allocate_lock
()
...
...
Misc/NEWS
View file @
d999c349
...
...
@@ -34,6 +34,9 @@ Core and Builtins
Library
-------
-
Issue
#
11866
:
Eliminated
race
condition
in
the
computation
of
names
for
new
threads
.
-
Issue
#
22219
:
The
zipfile
module
CLI
now
adds
entries
for
directories
(
including
empty
directories
)
in
ZIP
file
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment