Bitcoin Core  27.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
CSemaphore Class Reference

An implementation of a semaphore. More...

#include <sync.h>

Public Member Functions

 CSemaphore (int init) noexcept
 
 CSemaphore ()=delete
 
 CSemaphore (const CSemaphore &)=delete
 
 CSemaphore (CSemaphore &&)=delete
 
CSemaphoreoperator= (const CSemaphore &)=delete
 
CSemaphoreoperator= (CSemaphore &&)=delete
 
void wait () noexcept
 
bool try_wait () noexcept
 
void post () noexcept
 

Private Attributes

std::condition_variable condition
 
std::mutex mutex
 
int value
 

Detailed Description

An implementation of a semaphore.

See https://en.wikipedia.org/wiki/Semaphore_(programming)

Definition at line 307 of file sync.h.

Constructor & Destructor Documentation

◆ CSemaphore() [1/4]

CSemaphore::CSemaphore ( int  init)
inlineexplicitnoexcept

Definition at line 315 of file sync.h.

◆ CSemaphore() [2/4]

CSemaphore::CSemaphore ( )
delete

◆ CSemaphore() [3/4]

CSemaphore::CSemaphore ( const CSemaphore )
delete

◆ CSemaphore() [4/4]

CSemaphore::CSemaphore ( CSemaphore &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

CSemaphore& CSemaphore::operator= ( const CSemaphore )
delete

◆ operator=() [2/2]

CSemaphore& CSemaphore::operator= ( CSemaphore &&  )
delete

◆ post()

void CSemaphore::post ( )
inlinenoexcept

Definition at line 341 of file sync.h.

Here is the caller graph for this function:

◆ try_wait()

bool CSemaphore::try_wait ( )
inlinenoexcept

Definition at line 331 of file sync.h.

Here is the caller graph for this function:

◆ wait()

void CSemaphore::wait ( )
inlinenoexcept

Definition at line 324 of file sync.h.

Here is the caller graph for this function:

Member Data Documentation

◆ condition

std::condition_variable CSemaphore::condition
private

Definition at line 310 of file sync.h.

◆ mutex

std::mutex CSemaphore::mutex
private

Definition at line 311 of file sync.h.

◆ value

int CSemaphore::value
private

Definition at line 312 of file sync.h.


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