B2BITS FIX Antenna C++  2.31.0
Public Member Functions | List of all members
System::Semaphore Class Reference

Semaphore - a general synchronization mechanism. More...

#include <B2BITS_Semaphore.h>

Public Member Functions

void post ()
 Unlocks the semaphore. More...
 
 Semaphore ()
 Constructor. More...
 
 Semaphore (int aValue)
 Constructor. More...
 
void wait ()
 Locks the semaphore. More...
 
 ~Semaphore ()
 Destructor. More...
 

Detailed Description

Semaphore - a general synchronization mechanism.

Constructor & Destructor Documentation

◆ Semaphore() [1/2]

System::Semaphore::Semaphore ( )

Constructor.

Sets the semaphore's value to 0.

◆ Semaphore() [2/2]

System::Semaphore::Semaphore ( int  aValue)

Constructor.

Sets the semaphore to the given value.

Parameters
aValueValue to initialize semaphore with.

◆ ~Semaphore()

System::Semaphore::~Semaphore ( )

Destructor.

Member Function Documentation

◆ post()

void System::Semaphore::post ( )
inline

Unlocks the semaphore.

If the semaphore value resulting from this operation is positive, then no threads were blocked waiting for the semaphore to become unlocked; the semaphore value is simply incremented.

If the value of the semaphore resulting from this operation is 0, then one of the threads blocked waiting for the semaphore will be allowed to return successfully from its call to wait().

This method is reentrant with respect to signals and may be invoked from a signal-catching function.

◆ wait()

void System::Semaphore::wait ( )
inline

Locks the semaphore.

If the semaphore value is currently zero, then the calling thread will not return from this method until it either locks the semaphore or the call is interrupted by a signal.