DWFCore::DWFThreadWorker Interface Reference

#include "dwfcore/ThreadPool.h"

List of all members.


Detailed Description

This interface must be implemented by those classes that will be run in a worker thread in a DWFThreadPool.

Since:
1.0.1
A thread worker (a specialization of this class) encapsulates a unit of work to be executed in a thread context. The worker or it's dependents will never have access to the thread itself nor directly control it's behavior or define it's code path. (Although it is possible to make certain requests on the worker thread via the DWFThreadPool::Controller interface.) A thread worker is run in a sandbox within a pooled thread, it does not own the thread. Likewise, if the same worker is run again in the same thread pool, there is no guarantee that it will execute in the same thread context as any previous run.
Examples:

Threads/Threads.cpp.

Definition at line 61 of file ThreadPool.h.

Public Member Functions

virtual _DWFCORE_API ~DWFThreadWorker () throw ()
virtual _DWFCORE_API void begin ()=0 throw ()
virtual _DWFCORE_API void suspend () throw ()
virtual _DWFCORE_API void resume () throw ()

Protected Member Functions

_DWFCORE_API DWFThreadWorker () throw ()


Constructor & Destructor Documentation

virtual _DWFCORE_API DWFCore::DWFThreadWorker::~DWFThreadWorker  )  throw () [inline, virtual]
 

Destructor

Exceptions:
None 

Definition at line 72 of file ThreadPool.h.

_DWFCORE_API DWFCore::DWFThreadWorker::DWFThreadWorker  )  throw () [inline, protected]
 

Constructor

Exceptions:
None 

Definition at line 134 of file ThreadPool.h.


Member Function Documentation

virtual _DWFCORE_API void DWFCore::DWFThreadWorker::begin  )  throw () [pure virtual]
 

This method is invoked by a worker thread to execute specialized code in the thread. This may seem like an obvious point to make but... the worker thread is done with this interface when this function returns. Since the class specialization is aware of this condition (it contains the code), there is no state code or similar set, returned or maintained by this method or interface.

Exceptions:
None A thread worker may never throw exceptions from this method.

virtual _DWFCORE_API void DWFCore::DWFThreadWorker::resume  )  throw () [inline, virtual]
 

Request that the suspended worker resume itself.

This method will not call any resumption/suspension mechanism in the underlying thread library. Rather, it is provided for worker specializations to implement as appropriate in conjunction with the thread routine scoped by the begin() method. Additionally, no return value or arbitrary state code is returned here as the details and requirements and behaviors of this method are left entirely to the class specialization and therefore no restrictions or assumptions are placed on its use or definition.

Exceptions:
None 

Definition at line 122 of file ThreadPool.h.

virtual _DWFCORE_API void DWFCore::DWFThreadWorker::suspend  )  throw () [inline, virtual]
 

Request that the worker suspend itself.

This method will not call any resumption/suspension mechanism in the underlying thread library. Rather, it is provided for worker specializations to implement as appropriate in conjunction with the thread routine scoped by the begin() method. Additionally, no return value or arbitrary state code is returned here as the details and requirements and behaviors of this method are left entirely to the class specialization and therefore no restrictions or assumptions are placed on its use or definition.

Exceptions:
None 

Definition at line 104 of file ThreadPool.h.


The documentation for this interface was generated from the following file:
Generated on Tue Jan 6 22:39:42 2009 for Autodesk DWF Core Library by  doxygen 1.4.5