The Once wrapper.
More...
#include <thread.h>
|
template<typename F > |
static void | once (F &&f) noexcept |
| Runs a function once and only once.
|
|
static std::shared_ptr< Once > | create (Args &&...args) |
| Creates a new resource of the given type.
|
|
|
Loop & | loop () const noexcept |
| Gets the loop from which the resource was originated.
|
|
const uv_once_t * | raw () const noexcept |
| Gets the underlying raw data structure.
|
|
uv_once_t * | raw () noexcept |
| Gets the underlying raw data structure.
|
|
The Once wrapper.
Runs a function once and only once. Concurrent calls to once
will block all callers except one (it’s unspecified which one).
Definition at line 143 of file thread.h.
◆ once()
template<typename F >
static void uvw::Once::once |
( |
F && | f | ) |
|
|
inlinestaticnoexcept |
Runs a function once and only once.
The callback must be such that it's convertible to void(*)(void)
. Free functions and non-capturing lambdas are both viable solutions.
- Template Parameters
-
- Parameters
-
f | A valid callback function. |
Definition at line 159 of file thread.h.
The documentation for this class was generated from the following file: