If you can read this text, it means you are not experiencing this website at its best. This website is designed for used with a standards-compliant browser.
Current version: 2.3.2
ZThreads
A platform-independent, multi-threading and synchronization library for C++
Home Documentation Downloads CVS Contact
Executor Class Referenceabstract

#include <Executor.h>

Inheritance diagram for Executor:
Cancelable Waitable NonCopyable ConcurrentExecutor PoolExecutor SynchronousExecutor ThreadedExecutor

Public Member Functions

virtual void interrupt ()=0
 
virtual void execute (const Task &task)=0
 
- Public Member Functions inherited from Cancelable
virtual ~Cancelable ()
 Destroy a Cancelable object.
 
virtual void cancel ()=0
 
virtual bool isCanceled ()=0
 
- Public Member Functions inherited from Waitable
virtual ~Waitable ()
 Destroy a Waitable object.

 
virtual void wait ()=0
 
virtual bool wait (unsigned long timeout)=0
 

Detailed Description

Author
Eric Crahen http://www.code-foo.com
Date
<2003-07-16T22:39:39-0400>
Version
2.3.0

Execeutors are an implementation of the Executor pattern. This is a more versatile construct than a thread pool. A paper describing can be found in the proceedings of the 2002 VikingPLOP conference.

Executing

  • execute()ing task with an Executor will submit the task, scheduling it for execution at some future time depending on the Executor being used.

Disabling

  • cancel()ing an Executor will cause it to stop accepting new tasks.

Interrupting

  • interrupt()ing an Executor 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.

Waiting

  • wait()ing on a PoolExecutor will block the calling thread until all tasks that were submitted prior to the invocation of this function have completed.
See also
Cancelable
Waitable

Member Function Documentation

◆ execute()

virtual void execute ( const Task task)
pure virtual

Submit a task to this Executor.

Parameters
taskTask to be run by a thread managed by this executor
Precondition
The Executor should have been canceled prior to this invocation.
Postcondition
The submitted task will be run at some point in the future by this Executor.
Exceptions
Cancellation_Exceptionthrown if the Executor was canceled prior to the invocation of this function.

Implemented in ConcurrentExecutor, ThreadedExecutor, PoolExecutor, and SynchronousExecutor.

◆ interrupt()

virtual void interrupt ( )
pure virtual

If supported by the Executor, interrupt all tasks submitted prior to the invocation of this function.

Implemented in ConcurrentExecutor, PoolExecutor, SynchronousExecutor, and ThreadedExecutor.


The documentation for this class was generated from the following file: