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

Scheduler that executes tasks periodically or after a delay given a pool of threads. More...

#include <PeriodicTask.h>

Public Member Functions

 PeriodicSched (thread::Pool &pool)
 
 ~PeriodicSched ()
 
template<class Func , class PeriodicTask_ = PeriodicTask_<typename std::result_of<Func()>::type>>
PeriodicTask_::Ptr schedule (Func &&f, optional< MonoClock::Duration > period=optnull, optional< MonoClock::Duration > delay=optnull, const Id &id=idnull)
 Schedule a task for execution. More...
 

Static Public Member Functions

static mt_global (PeriodicSched, 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 PeriodicTask
 

Detailed Description

Scheduler that executes tasks periodically or after a delay given a pool of threads.

Constructor & Destructor Documentation

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

Member Function Documentation

static honey::PeriodicSched::mt_global ( PeriodicSched  ,
inst  ,
(future::AsyncSched::inst())   
)
static

Get singleton, uses global future::AsyncSched pool.

template<class Func , class PeriodicTask_ = PeriodicTask_<typename std::result_of<Func()>::type>>
PeriodicTask_::Ptr honey::PeriodicSched::schedule ( Func &&  f,
optional< MonoClock::Duration period = optnull,
optional< MonoClock::Duration delay = optnull,
const Id id = idnull 
)
inline

Schedule a task for execution.

Parameters
fthe function to execute
periodExecute function every period amount of time. If not specified then the function will execute only once. If execution takes longer than the period, then any subsequent execution will start immediately (not concurrently).
delayDelay first execution for an amount of time. If not specified then the function will be delayed for the amount of time specified by period.
iddisplay id for debugging
Returns
the scheduled task

Friends And Related Function Documentation

friend class PeriodicTask
friend

Member Data Documentation

bool honey::PeriodicSched::trace = false
static

Whether to log task execution flow.


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