Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members  

PoolExecutor Class Template Reference

#include <PoolExecutor.h>

Inheritance diagram for PoolExecutor:

Executor Cancelable Waitable NonCopyable List of all members.

Public Methods

 PoolExecutor (unsigned int min)
 PoolExecutor (unsigned int min, unsigned int max)
void setMax (unsigned int max)
void setMin (unsigned int)
unsigned int getMax ()
unsigned int getMin ()
virtual ~PoolExecutor () throw ()
 Destroy a new PoolExecutor.

virtual void execute (const RunnableHandle &task)
void execute (Runnable *task)
virtual void cancel ()
virtual bool isCanceled ()
virtual void wait ()
virtual bool wait (unsigned long timeout)

Detailed Description

template<class LockType, class FactoryType = DefaultThreadFactory, class QueueType = MonitoredQueue<RunnableHandle*, LockType>, typename RefType = CountedPtr<QueueType>>
class ZThread::PoolExecutor< LockType, FactoryType, QueueType, RefType >

Author:
Eric Crahen <crahen@cse.buffalo.edu>
Date:
<2002-06-29T07:57:47-0700>
Version:
2.2.2
This is an Executor that will run submitted tasks using a group of threads.

Submitting a NullTask will allow you to wait() for all real tasks being executed to complete; and not just to be serviced (started).

See also:
Executor


Constructor & Destructor Documentation

PoolExecutor unsigned int    min [inline]
 

Create a new PoolExecutor

Parameters:
min  - minimum number of threads to service tasks with

PoolExecutor unsigned int    min,
unsigned int    max
[inline]
 

Create a new PoolExecutor

Parameters:
min  - minimum number of threads to service tasks with
max  - maximum number of threads to service tasks with


Member Function Documentation

virtual void cancel   [inline, virtual]
 

See also:
Executor::cancel()

Implements Executor.

void execute Runnable   task [inline]
 

Convience method

See also:
Executor::execute(const RunnableHandle&)

Reimplemented from Executor.

virtual void execute const RunnableHandle &    task [inline, virtual]
 

Submit a light wieght task to an Executor. This will not block the calling thread very long. The submitted task will be executed at some later point by another thread.

Exceptions:
Cancellation_Exception  thrown if a task is submited when the executor has been canceled.
Synchronization_Exception  thrown is some other error occurs.
See also:
Executor::execute(RunnableHandle&)

Implements Executor.

unsigned int getMax   [inline]
 

Get the current maximum number of threads

Returns :
unsigned int - current maximum
Exceptions:
Interrupted_Exception 

unsigned int getMin   [inline]
 

Get the current minimum number of threads

Returns :
unsigned int - current minimum
Exceptions:
Interrupted_Exception 

virtual bool isCanceled   [inline, virtual]
 

See also:
Executor::isCanceled()

Implements Cancelable.

void setMax unsigned int    max [inline]
 

Change the maximum number of threads in the pool. As tasks are added to the Executor, more threads will be added as needed - up to the maximum number of worker threads set.

Parameters:
unsigned  int - new maximum number of worker threads.
Exceptions:
Interrupted_Exception 

void setMin unsigned    int [inline]
 

Change the minimum number of threads in the pool. When currently running tasks complete, and the Thread executing the task completes it can be removed. A Thread will never be instantly canceled because the minimum number of threads has changed. It is a gradual decline in the number of worker threads, they are canceled lazily.

Parameters:
unsigned  int - new minimum number of worker threads.
Exceptions:
Interrupted_Exception 

virtual bool wait unsigned long    timeout [inline, virtual]
 

See also:
Executor::wait(unsigned long)

Implements Executor.

virtual void wait   [inline, virtual]
 

See also:
Executor::wait()

Implements Executor.


The documentation for this class was generated from the following file:
Generated on Tue Aug 27 07:43:13 2002 for ZThread by doxygen1.2.17