Main Page   Namespace List   Class Hierarchy   Compound List   Compound Members  

ZThread::AbstractExecutor Class Template Reference

#include <AbstractExecutor.h>

Inheritance diagram for ZThread::AbstractExecutor::

ZThread::Executor ZThread::Cancelable ZThread::AsyncExecutor ZThread::PoolExecutor List of all members.

Public Methods

virtual ~AbstractExecutor () throw ()
virtual void cancel () throw (Synchronization_Exception)
virtual bool isCanceled () throw (Synchronization_Exception)
virtual bool available () throw (Synchronization_Exception)

Protected Types

typedef Q QUEUE
 Typedef.

typedef L LOCK
 Typedef.


Protected Methods

 AbstractExecutor () throw ()
virtual ThreadcreateWorker ()=0

Protected Attributes

QUEUE _queue
 TaskQueue.

LOCK _lock
 Serialize access.


Detailed Description

template<class L = Mutex, class Q = MonitoredQueue<Runnable*>> class ZThread::AbstractExecutor

Date:
03-05-2001
Author:
Eric Crahen
Version:
1.3.0

This template encapsulates the common behavior of threaded executors. It provides a means to select a locking mechananism & task queue class via template parameters.


Constructor & Destructor Documentation

AbstractExecutor ( ) throw () [inline, protected]
 

Protected default constructor

~AbstractExecutor ( ) throw () [inline, virtual]
 

Destroy this Executor


Member Function Documentation

bool available ( ) throw (Synchronization_Exception) [inline, virtual]
 

Block until this executor has become available to run new tasks.

This does not guarantee that another thread won't have submitted a task before some action is taken in response to this. However, it is useful as a general heuristic

Returns:
boolean
Exceptions:
InterruptedException  

Reimplemented from ZThread::Executor.

Reimplemented in ZThread::PoolExecutor.

void cancel ( ) throw (Synchronization_Exception) [inline, virtual]
 

Stop the execution of additional tasks by this executor. After this method has be invoked then the Executor will completed when the last task it was previously assigned is completed.

Exceptions:
InterruptedException  

Postcondition:
the executor no longer accepts new tasks. At this point the executor has a limited lifetime and is safe to join

See also:
Executor::cancel()

Reimplemented from ZThread::Executor.

Thread * createWorker ( ) [protected, pure virtual]
 

Create a new worker for the Executor, allows extedned classes to more easily special Worker objects w/o reimplementing the entire executor.

Reimplemented in ZThread::AsyncExecutor, and ZThread::PoolExecutor.

bool isCanceled ( ) throw (Synchronization_Exception) [inline, virtual]
 

Check the cancelation status of this Executor

Returns:
bool - Executor canceled
See also:
Cancelable::isCanceled()

Reimplemented from ZThread::Cancelable.


The documentation for this class was generated from the following file:
Generated at Fri Aug 31 09:07:59 2001 for ZThread by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001