uvw 3.4.0
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 try_wait () noexcept
 Tries to lock a semaphore.
 
- Public Member Functions inherited from uvw::uv_type< uv_sem_t >
loopparent () const noexcept
 Gets the loop from which the resource was originated.
 
const uv_sem_t * raw () const noexcept
 Gets the underlying raw data structure.
 
uv_sem_t * raw () noexcept
 Gets the underlying raw data structure.
 

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 257 of file thread.h.

Member Function Documentation

◆ try_wait()

bool uvw::semaphore::try_wait ( )
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: