tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tracktion::graph::Semaphore Class Reference

A basic counting semaphore. More...

#include "tracktion_Semaphore.h"

Public Member Functions

 Semaphore (int initialCount=0)
 Creates a semaphore with an initial count.
 
 ~Semaphore ()
 Destructor.
 
bool wait ()
 Decrements the count by one and if the result of this goes below zero the call will block.
 
bool try_wait ()
 Attemps to decrement the count by one.
 
bool timed_wait (std::uint64_t usecs)
 Performs a wait operation.
 
void signal (int count=1)
 Increases the count by the ammount specified.
 

Detailed Description

A basic counting semaphore.

Definition at line 27 of file tracktion_Semaphore.h.

Constructor & Destructor Documentation

◆ Semaphore()

tracktion::graph::Semaphore::Semaphore ( int  initialCount = 0)

Creates a semaphore with an initial count.

Definition at line 21 of file tracktion_Semaphore.cpp.

◆ ~Semaphore()

tracktion::graph::Semaphore::~Semaphore ( )

Destructor.

Definition at line 26 of file tracktion_Semaphore.cpp.

Member Function Documentation

◆ signal()

void tracktion::graph::Semaphore::signal ( int  count = 1)

Increases the count by the ammount specified.

If the count goes above zero, this will signal waiting threads, unblocking them.

Definition at line 45 of file tracktion_Semaphore.cpp.

◆ timed_wait()

bool tracktion::graph::Semaphore::timed_wait ( std::uint64_t  usecs)

Performs a wait operation.

If the wait would actually block, the block happens for the given period of time before returning or the semaphore is signalled, whichever happens first.

Returns
true if the decrement actually happened or false if the count would have gone below zero and this had to block.

Definition at line 40 of file tracktion_Semaphore.cpp.

◆ try_wait()

bool tracktion::graph::Semaphore::try_wait ( )

Attemps to decrement the count by one.

If the decrement leaves the count above zero this will return true. If the decrement would leave the count below zero this will not block and return false.

Definition at line 35 of file tracktion_Semaphore.cpp.

◆ wait()

bool tracktion::graph::Semaphore::wait ( )

Decrements the count by one and if the result of this goes below zero the call will block.

Returns
true if the decrement actually happened or false if there was a problem (like the maximum count has been exceeded)

Definition at line 30 of file tracktion_Semaphore.cpp.


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