summaryrefslogtreecommitdiff
path: root/src/waitress
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2020-05-27 02:04:02 -0700
committerBert JW Regeer <bertjw@regeer.org>2020-05-27 02:11:12 -0700
commitbebdaf59fc85694a243f56c180185fd58dd6c58b (patch)
treedf5dba29d0c128437e3deeb927a91fa49780c521 /src/waitress
parent51f411aed0806ac7e84ad84b26062efac51951d7 (diff)
downloadwaitress-bebdaf59fc85694a243f56c180185fd58dd6c58b.tar.gz
Update thread name to contain thread number
This way loggers that use the thread name display useful information
Diffstat (limited to 'src/waitress')
-rw-r--r--src/waitress/task.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/waitress/task.py b/src/waitress/task.py
index 8e7ab18..6350e34 100644
--- a/src/waitress/task.py
+++ b/src/waitress/task.py
@@ -57,8 +57,10 @@ class ThreadedTaskDispatcher(object):
self.queue_cv = threading.Condition(self.lock)
self.thread_exit_cv = threading.Condition(self.lock)
- def start_new_thread(self, target, args):
- t = threading.Thread(target=target, name="waitress", args=args)
+ def start_new_thread(self, target, thread_no):
+ t = threading.Thread(
+ target=target, name="waitress-{}".format(thread_no), args=(thread_no,)
+ )
t.daemon = True
t.start()
@@ -96,7 +98,7 @@ class ThreadedTaskDispatcher(object):
thread_no = thread_no + 1
threads.add(thread_no)
running += 1
- self.start_new_thread(self.handler_thread, (thread_no,))
+ self.start_new_thread(self.handler_thread, thread_no)
self.active_count += 1
thread_no = thread_no + 1
if running > count: