My Project 1.7.4
C++ Distributed Hash Table
Classes | Public Member Functions | List of all members
dht::Scheduler Class Reference

Job scheduler. More...

#include <scheduler.h>

Classes

struct  Job
 

Public Member Functions

Sp< Scheduler::Jobadd (time_point t, std::function< void()> &&job_func)
 
void add (const Sp< Scheduler::Job > &job, time_point t)
 
void edit (Sp< Scheduler::Job > &job, time_point t)
 
time_point run ()
 
time_point getNextJobTime () const
 
const time_point & time () const
 
time_point syncTime ()
 

Detailed Description

Job scheduler.

Maintains the timings upon which to execute a job.

Definition at line 37 of file scheduler.h.

Member Function Documentation

◆ add() [1/2]

void dht::Scheduler::add ( const Sp< Scheduler::Job > &  job,
time_point  t 
)
inline

Definition at line 60 of file scheduler.h.

◆ add() [2/2]

Sp< Scheduler::Job > dht::Scheduler::add ( time_point  t,
std::function< void()> &&  job_func 
)
inline

Adds another job to the queue.

Parameters
timeThe time upon which the job shall be executed.
job_funcThe job function to execute.
Returns
pointer to the newly scheduled job.

Definition at line 53 of file scheduler.h.

◆ edit()

void dht::Scheduler::edit ( Sp< Scheduler::Job > &  job,
time_point  t 
)
inline

Reschedules a job.

Parameters
jobThe job to edit.
tThe time at which the job shall be rescheduled.

Definition at line 71 of file scheduler.h.

◆ getNextJobTime()

time_point dht::Scheduler::getNextJobTime ( ) const
inline

Definition at line 108 of file scheduler.h.

◆ run()

time_point dht::Scheduler::run ( )
inline

Runs the jobs to do up to now.

Returns
The time for the next job to run.

Definition at line 87 of file scheduler.h.

◆ syncTime()

time_point dht::Scheduler::syncTime ( )
inline

Definition at line 117 of file scheduler.h.

◆ time()

const time_point & dht::Scheduler::time ( ) const
inline

Accessors for the common time reference used for synchronizing operations.

Definition at line 116 of file scheduler.h.


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