summaryrefslogtreecommitdiff
path: root/waitress/task.py
diff options
context:
space:
mode:
Diffstat (limited to 'waitress/task.py')
-rw-r--r--waitress/task.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/waitress/task.py b/waitress/task.py
index 7d36817..5a256e1 100644
--- a/waitress/task.py
+++ b/waitress/task.py
@@ -55,9 +55,9 @@ class ThreadedTaskDispatcher(object):
"""A Task Dispatcher that creates a thread for each task.
"""
- stop_count = 0 # Number of threads that will stop soon.
- start_new_thread = thread.start_new_thread
- logger = logger
+ stop_count = 0 # Number of threads that will stop soon.
+ thread_module = thread # for testing
+ logger = logger # for testing
def __init__(self):
self.threads = {} # { thread number -> 1 }
@@ -101,7 +101,10 @@ class ThreadedTaskDispatcher(object):
thread_no = thread_no + 1
threads[thread_no] = 1
running += 1
- self.start_new_thread(self.handler_thread, (thread_no,))
+ self.thread_module.start_new_thread(
+ self.handler_thread,
+ (thread_no,)
+ )
thread_no = thread_no + 1
if running > count:
# Stop threads.