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

The Semaphore wrapper. More...

#include <thread.h>

Inheritance diagram for uvw::Semaphore:
Collaboration diagram for uvw::Semaphore:

Public Member Functions

void post () noexcept
 Unlocks a semaphore.
void wait () noexcept
 Locks a semaphore.
bool tryWait () noexcept
 Tries to lock a semaphore.
Public Member Functions inherited from uvw::UnderlyingType< Semaphore, uv_sem_t >
Looploop () const noexcept
 Gets the loop from which the resource was originated.
const uv_sem_t * raw () const noexcept
 Gets the underlying raw data structure.

Additional Inherited Members

Static Public Member Functions inherited from uvw::UnderlyingType< Semaphore, uv_sem_t >
static std::shared_ptr< Semaphorecreate (Args &&...args)
 Creates a new resource of the given type.

Detailed Description

The Semaphore wrapper.

To create a Semaphore through a Loop, arguments follow:

  • An unsigned integer that specifies the initial value for the semaphore.

Definition at line 249 of file thread.h.

Member Function Documentation

◆ tryWait()

bool uvw::Semaphore::tryWait ( )
noexcept

Tries to lock a semaphore.

Returns
True in case of success, false otherwise.

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