Syntalos::WorkerTimer

Syntalos::WorkerTimer

Syntalos::WorkerTimer

A one-shot timer of an event-driven worker. More…

#include <moduleworker.h>

Public Functions

Name
WorkerTimer() =default
voidstart(const milliseconds_t & delay) const
Have the timer fire once after the given delay.
voidstart(const microseconds_t & delay) const
voidstop() const
Cancel the timer, if it is waiting.

Friends

Name
classWorkerEvents

Detailed Description

class Syntalos::WorkerTimer;

A one-shot timer of an event-driven worker.

Created with WorkerEvents::timer() in the setup() function of a worker. The timer does nothing until it is started, and then calls its function once in the worker’s event loop. It can be started again at any time, also from within its own function. A default-constructed timer does nothing.

Public Functions Documentation

function WorkerTimer

WorkerTimer() =default

function start

void start(
    const milliseconds_t & delay
) const

Have the timer fire once after the given delay.

If the timer is already waiting, it is set to the new delay. This has no effect while the event loop of the worker is not running.

function start

void start(
    const microseconds_t & delay
) const

function stop

void stop() const

Cancel the timer, if it is waiting.

Friends

friend WorkerEvents

friend class WorkerEvents(
    WorkerEvents 
);

Updated on 2026-11-26 at 18:54:14 +0000