libdisplaydevice master
C++ library to modify display devices.
retry_scheduler.h File Reference

Declarations for the RetryScheduler. More...

#include <algorithm>
#include <condition_variable>
#include <exception>
#include <functional>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <thread>
#include <type_traits>
#include <utility>
#include <vector>
#include "logging.h"
Include dependency graph for retry_scheduler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  display_device::detail::AutoConst< T, false >
 Leaves the base type unchanged. More...
 
struct  display_device::detail::AutoConst< T, true >
 Adds const to the base type. More...
 
class  display_device::RetryScheduler< T >
 A wrapper class around an interface that provides a thread-safe access to the interface and allows to schedule arbitrary logic for it to retry until it succeeds. More...
 
struct  display_device::SchedulerOptions
 Scheduler options to be used when scheduling executor function. More...
 
class  display_device::SchedulerStopToken
 A convenience class for stopping the RetryScheduler. More...
 

Concepts

concept  display_device::detail::OptionalFunction
 Given that we know that we are dealing with a function, check if it is an optional function (like std::function<...>) or other callable.
 
concept  display_device::detail::ExecuteWithoutStopToken
 Check if the function signature matches the acceptable signature for RetryScheduler::execute without a stop token.
 
concept  display_device::detail::ExecuteWithStopToken
 Check if the function signature matches the acceptable signature for RetryScheduler::execute with a stop token.
 
concept  display_device::detail::ExecuteCallbackLike
 Check if the function signature matches the acceptable signature for RetryScheduler::execute.
 

Typedefs

template<class T , bool AddConst>
using display_device::detail::auto_const_t = typename AutoConst<T, AddConst>::type
 A convenience template helper for adding const to the type.
 

Functions

void display_device::detail::logSchedulerException (const std::exception &exception, const char *message)
 Log an exception thrown by the scheduler or scheduler callback.
 

Detailed Description

Declarations for the RetryScheduler.

Typedef Documentation

◆ auto_const_t

template<class T , bool AddConst>
using display_device::detail::auto_const_t = typename AutoConst<T, AddConst>::type

A convenience template helper for adding const to the type.

Template Parameters
TBase type.
AddConstWhether to add const to the base type.

Function Documentation

◆ logSchedulerException()

void display_device::detail::logSchedulerException ( const std::exception & exception,
const char * message )
inline

Log an exception thrown by the scheduler or scheduler callback.

Parameters
exceptionException to log.
messageContext message to prepend.