My Project 3.2.0
C++ Distributed Hash Table
Loading...
Searching...
No Matches
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 edit (Sp< Scheduler::Job > &job, time_point t)
 
bool cancel (Sp< Scheduler::Job > &job)
 
time_point run ()
 
time_point getNextJobTime () const
 
const time_point & time () const
 
time_point syncTime ()
 
void syncTime (const time_point &n)
 

Detailed Description

Job scheduler.

Maintains the timings upon which to execute a job.

Definition at line 36 of file scheduler.h.

Member Function Documentation

◆ add()

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.

◆ cancel()

bool dht::Scheduler::cancel ( Sp< Scheduler::Job > & job)
inline

Definition at line 76 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 66 of file scheduler.h.

◆ getNextJobTime()

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

Definition at line 115 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 95 of file scheduler.h.

◆ syncTime() [1/2]

time_point dht::Scheduler::syncTime ( )
inline

Definition at line 124 of file scheduler.h.

◆ syncTime() [2/2]

void dht::Scheduler::syncTime ( const time_point & n)
inline

Definition at line 125 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 123 of file scheduler.h.


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