uvw 2.12.1
Loading...
Searching...
No Matches
uvw::Once Class Referencefinal

The Once wrapper. More...

#include <thread.h>

Inheritance diagram for uvw::Once:
Collaboration diagram for uvw::Once:

Static Public Member Functions

template<typename F >
static void once (F &&f) noexcept
 Runs a function once and only once.
 
- Static Public Member Functions inherited from uvw::UnderlyingType< Once, uv_once_t >
static std::shared_ptr< Oncecreate (Args &&...args)
 Creates a new resource of the given type.
 

Additional Inherited Members

- Public Member Functions inherited from uvw::UnderlyingType< Once, uv_once_t >
Looploop () 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.
 
- Protected Member Functions inherited from uvw::UnderlyingType< Once, uv_once_t >

Detailed Description

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.

Member Function Documentation

◆ 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
FType of the callback.
Parameters
fA valid callback function.

Definition at line 159 of file thread.h.


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