lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Semaphore Class Reference

Unnamed POSIX semaphore (sem_t) shared between threads of one process. More...

#include <Semaphore.hh>

Public Types

enum  semState { EMPTY , FULL }
 Initial state of the semaphore. More...
 

Public Member Functions

 Semaphore (semState initial)
 Initialize the semaphore with count 1 for FULL, otherwise 0.
 
 ~Semaphore ()
 Destroy the semaphore.
 
void take ()
 Decrement the semaphore, blocking while it is 0 (sem_wait()).
 
void give ()
 Increment the semaphore (sem_post()).
 

Detailed Description

Unnamed POSIX semaphore (sem_t) shared between threads of one process.

Member Enumeration Documentation

◆ semState

Initial state of the semaphore.

Enumerator
EMPTY 

Initial count 0: take() blocks until give() is called.

FULL 

Initial count 1.

Constructor & Destructor Documentation

◆ Semaphore()

Pds::Semaphore::Semaphore ( semState  initial)

Initialize the semaphore with count 1 for FULL, otherwise 0.

◆ ~Semaphore()

Pds::Semaphore::~Semaphore ( )

Destroy the semaphore.

Member Function Documentation

◆ give()

void Pds::Semaphore::give ( )
inline

Increment the semaphore (sem_post()).

◆ take()

void Pds::Semaphore::take ( )
inline

Decrement the semaphore, blocking while it is 0 (sem_wait()).


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