Ion
|
OnceFlag ensures that a target function is only evaluated once. More...
#include "once.h"
Public Member Functions | |
OnceFlag () | |
void | CallOnce (const std::function< void()> &target) |
If this OnceFlag instance has never executed a target function, CallOnce calls the target function. More... | |
Static Public Member Functions | |
static void | CallChecked (const std::function< bool()> &target) |
OnceFlag ensures that a target function is only evaluated once.
|
inlinestatic |
Definition at line 49 of file once.h.
References ion::port::ERROR, and LOG.
|
inline |
If this OnceFlag instance has never executed a target function, CallOnce calls the target function.
Inlines.
Thread safe, and all side effects of a call to a target function are guaranteed to be visible when the call returns. This call is not exception safe - if a target throws or the thread terminates this instance becomes invalid.
Definition at line 94 of file once.h.
References ion::port::YieldThread().
Referenced by ion::base::Lazy< T >::Get().