Table Of Contents

Previous topic

_WorkerThread

Next topic

_trash

This Page

phoenix_title ThreadPool

Object for managing a collection of threads and dispatching jobs to them.


class_hierarchy Inheritance Diagram

Inheritance diagram for class ThreadPool

Inheritance diagram of ThreadPool


method_summary Methods Summary

__init__ Create the ThreadPool
QueueJob Add a job to be processed
Shutdown Shutdown the ThreadPool

property_summary Properties Summary

JobCount  
ThreadCount  

api Class API



class ThreadPool(object)

Object for managing a collection of threads and dispatching jobs to them.


Methods



__init__(self, tcount, qsize=-1)

Create the ThreadPool

Parameters:
  • tcount – max number of threads to keep in the pool
  • qsize – size of job queue (-1 for unlimited)


QueueJob(self, funct, *args, **kwargs)

Add a job to be processed

Parameters:
  • funct – callable
  • args – list of any positional arguments to funct
  • kwargs – map of any keyword arguments to funct


Shutdown(self)

Shutdown the ThreadPool

Note

Blocking call until all threads have exited