distortos
v0.7.0
object-oriented C++ RTOS for microcontrollers
|
OnceFlag is a helper class for callOnce(). More...
#include "distortos/OnceFlag.hpp"
Public Member Functions | |
constexpr | OnceFlag () |
OnceFlag's constructor. More... | |
Private Attributes | |
Mutex | mutex_ |
internal mutex used by callOnce() More... | |
volatile bool | done_ |
tells whether any function was already called for this object (true) or not (false) More... | |
Friends | |
template<typename Function , typename... Args> | |
void | callOnce (OnceFlag &onceFlag, Function &&function, Args &&... args) |
Executes the callable object exactly once, even if called from multiple threads. More... | |
OnceFlag is a helper class for callOnce().
Similar to std::once_flag - http://en.cppreference.com/w/cpp/thread/once_flag Similar to POSIX pthread_once_t - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_once.html#
|
inline |
OnceFlag's constructor.
|
friend |
Executes the callable object exactly once, even if called from multiple threads.
Similar to std::call_once() - http://en.cppreference.com/w/cpp/thread/call_once Similar to POSIX pthread_once() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_once.html#
Function | is the function object that will be executed |
Args | are the arguments for Function |
[in] | onceFlag | is a reference to shared OnceFlag object |
[in] | function | is the function object that will be executed |
[in] | args | are arguments for function |
|
private |
tells whether any function was already called for this object (true) or not (false)
|
private |
internal mutex used by callOnce()