#include <SyncExecutor.h>
Inheritance diagram for ZThread::SyncExecutor::
Public Methods | |
SyncExecutor () | |
virtual | ~SyncExecutor () throw () |
virtual void | execute (Runnable *task) throw (Synchronization_Exception) |
virtual void | cancel () throw (Synchronization_Exception) |
virtual bool | isCanceled () throw (Synchronization_Exception) |
virtual void | join () throw (Synchronization_Exception) |
virtual bool | available () throw (Synchronization_Exception) |
virtual unsigned int | threadCount () throw (Synchronization_Exception) |
Protected Types | |
typedef L | LOCK |
Typedef. | |
Protected Attributes | |
LOCK | _lock |
Serialize access. | |
bool | _canceled |
Cancellation flag. |
An executor allows the efficient execution of a number of small unrelated 'Runnable' tasks, or LWP's without the over head of a large number of synchronization controls needed in a thread per task solution.
The executor itself contains heavy weight synchronization controls to do this, but it will not need new ones for each additional task. This overcomes resource problems thread-per-task designs must face
In general, executors queue tasks for execution by another thread or by a pool of threads. The queuing of task allows for a good deal of control over the order of execution.
SynchExecutors will never consume tasks. Thier behavior makes it very easy to use shared task objects, or task objects that have been automatically allocated.
|
Create a new SyncExecutor |
|
Destroy this Executor |
|
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
Reimplemented from ZThread::Executor. |
|
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.
Reimplemented from ZThread::Executor. |
|
Enqueue another task for execution.
Reimplemented from ZThread::Executor. |
|
Check the cancelation status of this Executor
Reimplemented from ZThread::Cancelable. |
|
Wait for this Executor to complete. The calling thread is blocked until the last task has been completed by this executor or until the calling thread has been interrupted.
Reimplemented from ZThread::Executor. |
|
Count of active threads operation on behalf of this executor This does not guarantee that another thread won't have submitted a task that changes the number of executing threads before some action is taken in response to this. However, it is useful as a general heuristic
Reimplemented from ZThread::Executor. |