#include <ThreadedExecutor.h>

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) |
virtual void | interrupt ()=0 |
virtual void | execute (const Task &task)=0 |
![]() | |
virtual | ~Cancelable () |
Destroy a Cancelable object. | |
virtual void | cancel ()=0 |
virtual bool | isCanceled ()=0 |
![]() | |
virtual | ~Waitable () |
Destroy a Waitable object. | |
virtual void | wait ()=0 |
virtual bool | wait (unsigned long timeout)=0 |
Detailed Description
- Date
- <2003-07-16T22:39:13-0400>
- Version
- 2.3.0
A ThreadedExecutor spawns a new thread to execute each task submitted. A ThreadedExecutor supports the following optional operations,
- cancel()ing a ThreadedExecutor will cause it to stop accepting new tasks.
- interrupt()ing a ThreadedExecutor will cause the any thread running a task which was submitted prior to the invocation of this function to be interrupted during the execution of that task.
- wait()ing on a ThreadedExecutor will block the calling thread until all tasks that were submitted prior to the invocation of this function have completed.
- See also
- Executor.
Member Function Documentation
◆ cancel()
|
virtual |
- See also
- Cancelable::cancel()
Implements Cancelable.
◆ execute()
|
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.
- Exceptions
-
Cancellation_Exception thrown if this Executor has been canceled. The Task being submitted will not be executed by this Executor.
- See also
- Executor::execute(const Task&)
Implements Executor.
◆ 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 Executor.
◆ isCanceled()
|
virtual |
- See also
- Cancelable::isCanceled()
Implements Cancelable.
◆ wait() [1/2]
|
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.
- Exceptions
-
Interrupted_Exception thrown if the calling thread is interrupted before the set of tasks for which it was waiting complete.
- See also
- Waitable::wait()
Implements Waitable.
◆ wait() [2/2]
|
virtual |
Operates the same as ThreadedExecutor::wait() but with a timeout.
- Parameters
-
timeout maximum amount of time, in milliseconds, to wait for the currently submitted set of Tasks to complete.
- Exceptions
-
Interrupted_Exception thrown if the calling thread is interrupt()ed while waiting for the current set of Tasks to complete.
- Returns
- true if the set of tasks running at the time this function is invoked complete before timeout milliseconds elapse.
- false othewise.
Implements Waitable.
The documentation for this class was generated from the following file:
- ThreadedExecutor.h