Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
honey::DepTask Class Referenceabstract

Base class of DepTask_, can be added to scheduler. Instances must be created through class DepTask_. More...

#include <DepTask.h>

Inheritance diagram for honey::DepTask:
Inheritance graph
[legend]
Collaboration diagram for honey::DepTask:
Collaboration graph
[legend]

Public Types

typedef SharedPtr< DepTaskPtr
 
typedef function< void()> Func
 
typedef DepNode< DepTask * > DepNode
 
typedef DepGraph< DepTask::DepNodeDepGraph
 

Public Member Functions

virtual ~DepTask ()
 
bool active () const
 Check if task is in queue or executing. More...
 
void interrupt (const Exception::ConstPtr &e=new thread::Interrupted)
 Request an interrupt in the executing task's thread. More...
 
bool interruptRequested ()
 Check whether an interrupt has been requested for the executing task's thread. More...
 
void setPriority (int priority)
 Set task's thread execution scheduling priority. More...
 
int getPriority () const
 Get task's thread execution scheduling priority. More...
 
void setId (const Id &id)
 Set id used for dependency graph and debug output. More...
 
const IdgetId () const
 
DepNodedeps ()
 Get dependency node. Upstream and downstream tasks can be specified through the node. More...
 
 operator const Id & () const
 Get id. More...
 
String info () const
 Get task info for prepending to a log record. More...
 
- Public Member Functions inherited from honey::SharedObj< DepTask >
 SharedObj (Alloc &&a=Alloc()) debug_if(
 Construct with allocator that is called to deallocate this shared object when all references have been released. More...
 

Static Public Member Functions

static DepTaskcurrent ()
 Get the current task object. Must be called from a task functor. More...
 

Protected Types

enum  State {
  State::idle, State::queued, State::depUpWait, State::exec,
  State::depDownWait
}
 

Protected Member Functions

 DepTask (const Id &id)
 
virtual void exec ()=0
 
virtual void resetFunctor ()=0
 
void bindDirty ()
 
void operator() ()
 
void finalize_ ()
 Clean up task after execution. More...
 
virtual void trace (const String &file, int line, const String &msg) const
 
virtual bool traceEnabled () const
 
- Protected Member Functions inherited from honey::SharedObj< DepTask >
void finalize ()
 Destroys object. Called when strong reference count reaches 0. May be overridden to prevent destruction. More...
 

Protected Attributes

DepNode _depNode
 
Mutex _lock
 
Atomic< State_state
 
int _regCount
 
DepSched_sched
 
WeakPtr< DepTask_root
 
int _bindId
 
bool _bindDirty
 
int _depUpWaitInit
 
Atomic< int > _depUpWait
 
int _depDownWaitInit
 
Atomic< int > _depDownWait
 
DepGraph::Vertex_vertex
 
bool _onStack
 
Thread_thread
 
int _priority
 

Friends

class DepSched
 
struct mt::Funcptr< void()>
 

Detailed Description

Base class of DepTask_, can be added to scheduler. Instances must be created through class DepTask_.

Member Typedef Documentation

typedef function<void ()> honey::DepTask::Func

Member Enumeration Documentation

enum honey::DepTask::State
strongprotected
Enumerator
idle 

Not active.

queued 

Queued for execution.

depUpWait 

Waiting for upstream tasks (dependency subgraph) to complete.

exec 

Executing functor.

depDownWait 

Waiting for downsteam tasks (immediate dependees) to complete.

Constructor & Destructor Documentation

virtual honey::DepTask::~DepTask ( )
inlinevirtual
honey::DepTask::DepTask ( const Id id)
protected

Member Function Documentation

bool honey::DepTask::active ( ) const
inline

Check if task is in queue or executing.

void honey::DepTask::bindDirty ( )
protected
DepTask & honey::DepTask::current ( )
static

Get the current task object. Must be called from a task functor.

DepNode& honey::DepTask::deps ( )
inline

Get dependency node. Upstream and downstream tasks can be specified through the node.

Out links are 'upstream' tasks that will be completed before this one. In links are 'downstream' tasks that will be completed after this one.

virtual void honey::DepTask::exec ( )
protectedpure virtual
void honey::DepTask::finalize_ ( )
protected

Clean up task after execution.

const Id& honey::DepTask::getId ( ) const
inline
int honey::DepTask::getPriority ( ) const
inline

Get task's thread execution scheduling priority.

See also
Thread::getPriority()
String honey::DepTask::info ( ) const

Get task info for prepending to a log record.

void honey::DepTask::interrupt ( const Exception::ConstPtr &  e = new thread::Interrupted)
inline

Request an interrupt in the executing task's thread.

See also
Thread::interrupt()
bool honey::DepTask::interruptRequested ( )
inline

Check whether an interrupt has been requested for the executing task's thread.

honey::DepTask::operator const Id & ( ) const
inline

Get id.

void honey::DepTask::operator() ( )
protected
virtual void honey::DepTask::resetFunctor ( )
protectedpure virtual
void honey::DepTask::setId ( const Id id)
inline

Set id used for dependency graph and debug output.

void honey::DepTask::setPriority ( int  priority)
inline

Set task's thread execution scheduling priority.

See also
Thread::setPriority()
void honey::DepTask::trace ( const String file,
int  line,
const String msg 
) const
protectedvirtual

Reimplemented from honey::thread::Pool::Task.

bool honey::DepTask::traceEnabled ( ) const
inlineprotectedvirtual

Reimplemented from honey::thread::Pool::Task.

Friends And Related Function Documentation

friend class DepSched
friend
friend struct mt::Funcptr< void()>
friend

Member Data Documentation

bool honey::DepTask::_bindDirty
protected
int honey::DepTask::_bindId
protected
Atomic<int> honey::DepTask::_depDownWait
protected
int honey::DepTask::_depDownWaitInit
protected
DepNode honey::DepTask::_depNode
protected
Atomic<int> honey::DepTask::_depUpWait
protected
int honey::DepTask::_depUpWaitInit
protected
Mutex honey::DepTask::_lock
protected
bool honey::DepTask::_onStack
protected
int honey::DepTask::_priority
protected
int honey::DepTask::_regCount
protected
WeakPtr<DepTask> honey::DepTask::_root
protected
DepSched* honey::DepTask::_sched
protected
Atomic<State> honey::DepTask::_state
protected
Thread* honey::DepTask::_thread
protected
DepGraph::Vertex* honey::DepTask::_vertex
protected

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