[issue11866] race condition in threading._newname()
Raymond Hettinger
report at bugs.python.org
Sat Aug 13 09:52:10 CEST 2011
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
I think the patch is correct.
FWIW, my style is to prebind the next method, making the counter completely self-contained (like a closure):
+_counter = itertools.count().next
def _newname(template="Thread-%d"):
global _counter
- _counter = _counter + 1
- return template % _counter
+ return template % _counter()
----------
assignee: -> rhettinger
nosy: +rhettinger
resolution: -> accepted
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11866>
_______________________________________
More information about the Python-bugs-list
mailing list