dispenso
A library for task parallelism
 
Loading...
Searching...
No Matches
dispenso::TimedTask Class Reference

#include <timed_task.h>

Public Member Functions

 TimedTask (const TimedTask &)=delete
 
 TimedTask (TimedTask &&other)
 
TimedTaskoperator= (const TimedTask &)=delete
 
TimedTaskoperator= (TimedTask &&other)
 
void cancel ()
 
void detach ()
 
size_t calls () const
 
 ~TimedTask ()
 

Friends

class TimedTaskScheduler
 

Detailed Description

A timed task type. This encapsulates a function that will run at a time scheduled in the future, and optionally periodically for a specified number of times.

Definition at line 40 of file timed_task.h.

Constructor & Destructor Documentation

◆ TimedTask()

dispenso::TimedTask::TimedTask ( TimedTask &&  other)
inline

Definition at line 43 of file timed_task.h.

◆ ~TimedTask()

dispenso::TimedTask::~TimedTask ( )
inline

Destroy the timed task. If detach() has not been called, this will cancel further calls to the underlying scheduled function, and will wait if necessary until the function is no longer in progress. This is to naturally protect resources that may be used by the function. If detach() was called, the destructor will not block.

Definition at line 85 of file timed_task.h.

Member Function Documentation

◆ calls()

size_t dispenso::TimedTask::calls ( ) const
inline

See how many calls there have been to the underlying function have completed thus far.

Returns
the count of calls made this far to the underlying function.

Definition at line 74 of file timed_task.h.

◆ cancel()

void dispenso::TimedTask::cancel ( )
inline

Cancel the task. No further runs to the underlying function will occur (though any calls in progress will complete).

Definition at line 55 of file timed_task.h.

◆ detach()

void dispenso::TimedTask::detach ( )
inline

Detach this task so that it cannot block in destruction, and destruction does not cancel further runs to the underlying function. This is only to be used in cases where the underlying schedulable and any function resources are expected to outlive any other copy of the task.

Definition at line 65 of file timed_task.h.

◆ operator=()

TimedTask & dispenso::TimedTask::operator= ( TimedTask &&  other)
inline

Definition at line 46 of file timed_task.h.

Friends And Related Symbol Documentation

◆ TimedTaskScheduler

Definition at line 117 of file timed_task.h.


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