summaryrefslogtreecommitdiff
path: root/waitress/task.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-07-06 13:25:15 -0400
committerChris McDonough <chrism@plope.com>2012-07-06 13:25:15 -0400
commite4051f87347c866f7d66399dc91315ab862fd411 (patch)
treeeafcc1f76ad7389b999db19eb4a89ed996aa1324 /waitress/task.py
parente18bbfde117c8449cf67f9a3f14dd00b3cd93cd2 (diff)
downloadwaitress-fix.idemonkeys.tar.gz
- Appease IDEs that want to monkeypatch the thread module by changing afix.idemonkeys
testing pattern. With any luck, the following will no longer be a problem: http://devnet.jetbrains.net/thread/433486
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.