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

AbstractExecutor Class Template Reference

#include <AbstractExecutor.h>

Inheritance diagram for AbstractExecutor:

Executor Cancelable Waitable NonCopyable 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 QueueType
 Typedef.

typedef L LockType
 Typedef.


Protected Methods

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

Protected Attributes

QueueType _queue
 TaskQueue.

LockType _lock
 Serialize access.


Detailed Description

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

Author:
Eric Crahen <crahen@cse.buffalo.edu>
Date:
<2002-05-28T20:21:50-0400>
Version:
2.1.2
This template encapsulates the common behavior of threaded executors. It provides a means to select a locking mechananism & task queue class via template parameters.

Any Executor can be extended and can override the createWorker() function to alter how the Work threads behave.


Constructor & Destructor Documentation

AbstractExecutor   throw () [inline, protected]
 

Protected default constructor

virtual ~AbstractExecutor   throw () [inline, virtual]
 

Destroy this Executor


Member Function Documentation

virtual 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 in PoolExecutor.

virtual 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()

Implements Executor.

virtual 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.

Implemented in PoolExecutor.

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

Check the cancelation status of this Executor

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

Implements Cancelable.


The documentation for this class was generated from the following file:
Generated on Fri May 31 13:29:03 2002 for ZThread by doxygen1.2.15