Anklang-0.3.0.dev712+gdc4e642f anklang-0.3.0.dev712+gdc4e642f
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Ase::ScopedSemaphore Class Reference

Public Member Functions

 ScopedSemaphore () noexcept
 Create a process-local semaphore.
 
int post () noexcept
 Unlock ScopedSemaphore.
 
int wait () noexcept
 Wait indefinitely for ScopedSemaphore.
 
int wait_for (uint64_t useconds) noexcept
 Wait for ScopedSemaphore with timeout (microseconds).
 
 ~ScopedSemaphore () noexcept
 Release associated semaphore resources.
 

Detailed Description

Definition at line 104 of file platform.hh.

Constructor & Destructor Documentation

◆ ScopedSemaphore()

Ase::ScopedSemaphore::ScopedSemaphore ( )
explicitnoexcept

Create a process-local semaphore.

A RAII wrapper around POSIX unnamed semaphores for thread synchronization.

Definition at line 853 of file platform.cc.

References assert_return, and sem_init().

◆ ~ScopedSemaphore()

Ase::ScopedSemaphore::~ScopedSemaphore ( )
noexcept

Release associated semaphore resources.

Definition at line 900 of file platform.cc.

References assert_return, and sem_destroy().

Member Function Documentation

◆ post()

int Ase::ScopedSemaphore::post ( )
noexcept

Unlock ScopedSemaphore.

Post (increment) the semaphore value,.

Returns
0 on success

Definition at line 863 of file platform.cc.

References errno(), and sem_post().

◆ wait()

int Ase::ScopedSemaphore::wait ( )
noexcept

Wait indefinitely for ScopedSemaphore.

Wait indefinitely for the semaphore to become available,.

Returns
0 on success

Definition at line 873 of file platform.cc.

References errno(), and sem_wait().

◆ wait_for()

int Ase::ScopedSemaphore::wait_for ( uint64_t  useconds)
noexcept

Wait for ScopedSemaphore with timeout (microseconds).

Wait for the semaphore with a timeout in µseconds,.

Returns
0 on success

Definition at line 883 of file platform.cc.

References errno(), long, sem_timedwait(), time_t, Ase::timestamp_realtime(), and uint64_t.


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