Vuo 2.4.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
VuoThreadUtilities::Semaphore Class Reference

Description

Provides a semaphore data structure, similar to the C++20 binary_semaphore.

Although RAII methods of locking (e.g. std::lock_guard) are preferred, the semaphore makes it possible to acquire a lock on one thread and release it on another (which is not permitted with a std::mutex).

https://stackoverflow.com/questions/4792449/c0x-has-no-semaphores-how-to-synchronize-threads

Definition at line 44 of file VuoThreadUtilities.hh.

Public Member Functions

 Semaphore (void)
 Creates a semaphore that is ready to be acquired.
 
void acquire (void)
 Waits until the semaphore is available, then claims it.
 
void release (void)
 Un-claims the semaphore, making it available to be acquired again.
 

Constructor & Destructor Documentation

◆ Semaphore()

VuoThreadUtilities::Semaphore::Semaphore ( void  )

Creates a semaphore that is ready to be acquired.

Definition at line 15 of file VuoThreadUtilities.cc.

Member Function Documentation

◆ acquire()

void VuoThreadUtilities::Semaphore::acquire ( void  )

Waits until the semaphore is available, then claims it.

Definition at line 23 of file VuoThreadUtilities.cc.

◆ release()

void VuoThreadUtilities::Semaphore::release ( void  )

Un-claims the semaphore, making it available to be acquired again.

Definition at line 33 of file VuoThreadUtilities.cc.


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