flup.server.threadpool
¶
- class flup.server.threadpool.ThreadPool(minSpare=1, maxSpare=5, maxThreads=2147483647)¶
Thread pool that maintains the number of idle threads between minSpare and maxSpare inclusive. By default, there is no limit on the number of threads that can be started, but this can be controlled by maxThreads.
- addJob(job, allowQueuing=True)¶
Adds a job to the work queue. The job object should have a run() method. If allowQueuing is True (the default), the job will be added to the work queue regardless if there are any idle threads ready. (The only way for there to be no idle threads is if maxThreads is some reasonable, finite limit.)
Otherwise, if allowQueuing is False, and there are no more idle threads, the job will not be queued.
Returns True if the job was queued, False otherwise.
- shutdown()¶
shutdown all workers.