#include <ThreadedExecutor.h>
Inheritance diagram for ZThread::ThreadedExecutor:
Public Member Functions | |
ThreadedExecutor () | |
Create a new ThreadedExecutor. | |
virtual | ~ThreadedExecutor () |
Destroy a ThreadedExecutor. | |
virtual void | interrupt () |
virtual void | execute (const Task &) |
virtual void | cancel () |
virtual bool | isCanceled () |
virtual void | wait () |
virtual bool | wait (unsigned long timeout) |
void ZThread::ThreadedExecutor::cancel | ( | ) | [virtual] |
void ZThread::ThreadedExecutor::execute | ( | const Task & | ) | [virtual] |
Submit a task to this Executor. This will not block the current thread for very long. A new thread will be created and the task will be run() within the context of that new thread.
Cancellation_Exception | thrown if this Executor has been canceled. The Task being submitted will not be executed by this Executor. |
Implements ZThread::Executor.
void ZThread::ThreadedExecutor::interrupt | ( | ) | [virtual] |
Interrupting a ThreadedExecutor will cause an interrupt() to be sent to every Task that has been submitted at the time this function is called. Tasks that are submitted after this function is called will not be interrupt()ed; unless this function is invoked again().
Implements ZThread::Executor.
bool ZThread::ThreadedExecutor::isCanceled | ( | ) | [virtual] |
bool ZThread::ThreadedExecutor::wait | ( | unsigned long | timeout | ) | [virtual] |
Operates the same as ThreadedExecutor::wait() but with a timeout.
timeout | maximum amount of time, in milliseconds, to wait for the currently submitted set of Tasks to complete. |
Interrupted_Exception | thrown if the calling thread is interrupt()ed while waiting for the current set of Tasks to complete. |
Implements ZThread::Waitable.
void ZThread::ThreadedExecutor::wait | ( | ) | [virtual] |
Waiting on a ThreadedExecutor will block the current thread until all tasks submitted to the Executor up until the time this function was called have completed.
Tasks submitted after this function is called will not delay a thread that was already waiting on the Executor any longer. In order to wait for those tasks to complete as well, another wait() would be needed.
Interrupted_Exception | thrown if the calling thread is interrupted before the set of tasks for which it was waiting complete. |
Implements ZThread::Waitable.