when can't start new thread, the thread.error will through out.
--- threadpool.py.bak 2009-10-27 17:29:44.000000000 +0800
+++ threadpool.py 2009-10-27 17:38:14.000000000 +0800
@@ -69,9 +69,13 @@
# Maintain minimum number of spares.
while self._idleCount < self._minSpare and \
self._workerCount < self._maxThreads:
+ try:
+ thread.start_new_thread(self._worker, ())
+ except thread.error, e:
+ return False
self._workerCount += 1
self._idleCount += 1
- thread.start_new_thread(self._worker, ())
+
# Hand off the job.
if self._idleCount or allowQueuing: