libdisplaydevice latest
C++ library to modify display devices.
display_device::SchedulerStopToken Class Referencefinal

A convenience class for stopping the RetryScheduler. More...

#include <src/common/include/display_device/retry_scheduler.h>

Public Member Functions

SchedulerStopTokenoperator= (const SchedulerStopToken &)=delete
 Deleted copy operator.
 
void requestStop ()
 Request the scheduler to be stopped.
 
 SchedulerStopToken (const SchedulerStopToken &)=delete
 Deleted copy constructor.
 
 SchedulerStopToken (std::function< void()> cleanup)
 Default constructor.
 
bool stopRequested () const
 Check if stop was requested.
 
 ~SchedulerStopToken ()
 Executes cleanup logic if scheduler stop was requested.
 

Detailed Description

A convenience class for stopping the RetryScheduler.

It is conceptually similar to std::stop_token except that it also uses RAII to perform a cleanup. This allows to return void types in the RetryScheduler without a hassle.

Constructor & Destructor Documentation

◆ SchedulerStopToken()

display_device::SchedulerStopToken::SchedulerStopToken ( std::function< void()> cleanup)
explicit

Default constructor.

Parameters
cleanupFunction to be executed once the destructor is called (object goes out of scope).

Member Function Documentation

◆ stopRequested()

bool display_device::SchedulerStopToken::stopRequested ( ) const
nodiscard

Check if stop was requested.

Returns
True if stop was requested, false otherwise.

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