class documentation

class MarkedThreadPool(object):

Constructor: MarkedThreadPool(numThreads)

View In Hierarchy

Flexible thread pool class. Creates a pool of threads, then accepts tasks that will be dispatched to the next available thread.

Method __init__ Initialize the thread pool with numThreads workers.
Method get_next_task Retrieve the next task from the task queue. For use only by ThreadPoolThread objects contained in the pool.
Method get_thread_count @return: number of threads in the pool.
Method join_all Clear the task queue and terminate all pooled threads, optionally allowing the tasks and threads to finish.
Method queue_task Insert a task into the queue. task must be callable; args and taskCallback can be None.
Method remove_marker Remove the marker from the currently executing tasks. Only one task with the given marker can be executed at a given time
Method set_thread_count External method to set the current pool size. Acquires the resizing lock, then calls the internal version to do real work.
Method __set_thread_count_nolock Set the current pool size, spawning or terminating threads if necessary. Internal use only; assumes the resizing lock is held.
Instance Variable __isJoining Undocumented
Instance Variable __markers Undocumented
Instance Variable __resizeLock Undocumented
Instance Variable __taskLock Undocumented
Instance Variable __tasks Undocumented
Instance Variable __threads Undocumented
def __init__(self, numThreads):

Initialize the thread pool with numThreads workers.

def get_next_task(self):

Retrieve the next task from the task queue. For use only by ThreadPoolThread objects contained in the pool.

def get_thread_count(self):

@return: number of threads in the pool.

def join_all(self, wait_for_tasks=True, wait_for_threads=True):

Clear the task queue and terminate all pooled threads, optionally allowing the tasks and threads to finish.

def queue_task(self, marker, task, args=None, taskCallback=None):

Insert a task into the queue. task must be callable; args and taskCallback can be None.

def remove_marker(self, marker):

Remove the marker from the currently executing tasks. Only one task with the given marker can be executed at a given time

def set_thread_count(self, newNumThreads):

External method to set the current pool size. Acquires the resizing lock, then calls the internal version to do real work.

def __set_thread_count_nolock(self, newNumThreads):

Set the current pool size, spawning or terminating threads if necessary. Internal use only; assumes the resizing lock is held.

__isJoining: bool =

Undocumented

__markers: set =

Undocumented

__resizeLock =

Undocumented

__taskLock =

Undocumented

__tasks: list =

Undocumented

__threads: list =

Undocumented