Honeycomb  0.1
Component-Model Framework
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
honey::DepSched Class Reference

Scheduler that serializes and parallelizes task execution given a dependency graph of tasks and a pool of threads. More...

#include <DepTask.h>

Public Member Functions

 DepSched (thread::Pool &pool)
 
bool reg (DepTask &task)
 Register a task, linking it into this scheduler's dependency graph. More...
 
bool unreg (DepTask &task)
 Unregister a task. Returns false if not registered. More...
 
bool enqueue (DepTask &task)
 Schedule a task for execution. Returns false if task is already active. More...
 

Static Public Member Functions

static mt_global (DepSched, inst,(future::AsyncSched::inst()))
 Get singleton, uses global future::AsyncSched pool. More...
 

Static Public Attributes

static bool trace = false
 Whether to log task execution flow. More...
 

Friends

class DepTask
 

Detailed Description

Scheduler that serializes and parallelizes task execution given a dependency graph of tasks and a pool of threads.

To run a task, first register it and any dependent tasks with DepSched::reg(), then call DepSched::enqueue(rootTask).

Constructor & Destructor Documentation

honey::DepSched::DepSched ( thread::Pool pool)
Parameters
poolShared ref to thread pool with which all tasks will be enqueued.

Member Function Documentation

bool honey::DepSched::enqueue ( DepTask task)

Schedule a task for execution. Returns false if task is already active.

Enqueuing a task performs a binding:

  • the enqueued task becomes a root task, and the entire subgraph of upstream tasks (dependencies) are bound to this root
  • the subgraph of tasks are bound to this scheduler

A task can be enqueued again once it is complete. Wait for completion by calling DepTask_::future().get(). Be wary of enqueueing tasks that are upstream of other currently active tasks.

This method will error if:

  • task is not registered
  • task or any upstream tasks are active
  • a cyclic dependency is detected
static honey::DepSched::mt_global ( DepSched  ,
inst  ,
(future::AsyncSched::inst())   
)
static

Get singleton, uses global future::AsyncSched pool.

bool honey::DepSched::reg ( DepTask task)

Register a task, linking it into this scheduler's dependency graph.

Tasks can be registered with multiple schedulers.

Returns
false if a task with the same id is already registered
bool honey::DepSched::unreg ( DepTask task)

Unregister a task. Returns false if not registered.

Friends And Related Function Documentation

friend class DepTask
friend

Member Data Documentation

bool honey::DepSched::trace = false
static

Whether to log task execution flow.


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