RAUL  0.8.0
Public Member Functions | List of all members
Raul::Semaphore Class Reference

Counting semaphore. More...

#include <Semaphore.hpp>

Inherits noncopyable.

Public Member Functions

 Semaphore (unsigned int initial)
 
void reset (unsigned int initial)
 Destroy and reset the semaphore to an initial value. More...
 
void post ()
 Increment (and signal any waiters). More...
 
void wait ()
 Wait until count is > 0, then decrement. More...
 
bool try_wait ()
 Non-blocking version of wait(). More...
 

Detailed Description

Counting semaphore.

Member Function Documentation

◆ reset()

void Raul::Semaphore::reset ( unsigned int  initial)
inline

Destroy and reset the semaphore to an initial value.

This must not be called while there are any waiters.

◆ post()

void Raul::Semaphore::post ( )
inline

Increment (and signal any waiters).

Realtime safe.

Referenced by Raul::Slave::whip().

◆ wait()

void Raul::Semaphore::wait ( )
inline

Wait until count is > 0, then decrement.

Obviously not realtime safe.

◆ try_wait()

bool Raul::Semaphore::try_wait ( )
inline

Non-blocking version of wait().

Returns
true if decrement was successful (lock was acquired).

Realtime safe?


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