[issue27664] Allow specifying prefix for thread name in concurrent.futures.ThreadPoolExecutor
Gregory P. Smith
report at bugs.python.org
Sun Aug 7 13:12:51 EDT 2016
Gregory P. Smith added the comment:
A workaround for this on 3.5 and older versions is probably to do:
initialization:
num_q = queue.Queue()
map(num_q.put, range(max_workers))
Then schedule max_workers identical tasks:
def task():
threading.current_thread().name = '%s_%d' % (your_prefix, num_q.get())
num_q.task_done()
num_q.join() # block so that this thread cannot take a new thread naming task until all other tasks are complete. guaranteeing we are executed once per max_workers threads.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27664>
_______________________________________
More information about the Python-bugs-list
mailing list