summaryrefslogtreecommitdiff
path: root/flup/server/threadpool.py
diff options
context:
space:
mode:
Diffstat (limited to 'flup/server/threadpool.py')
-rw-r--r--flup/server/threadpool.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/flup/server/threadpool.py b/flup/server/threadpool.py
index 98d3afe..e3d1bcd 100644
--- a/flup/server/threadpool.py
+++ b/flup/server/threadpool.py
@@ -89,9 +89,12 @@ class ThreadPool(object):
# Maintain minimum number of spares.
while self._idleCount < self._minSpare and \
self._workerCount < self._maxThreads:
+ try:
+ self._start_new_thread()
+ except thread.error:
+ return False
self._workerCount += 1
self._idleCount += 1
- self._start_new_thread()
# Hand off the job.
if self._idleCount or allowQueuing: