SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::Core::Semaphore Class Referencefinal

#include <swcdb/core/Semaphore.h>

+ Collaboration diagram for SWC::Core::Semaphore:

Public Member Functions

 Semaphore (size_t sz=1, size_t pre_acquire=0) noexcept
 
 Semaphore (const Semaphore &)=delete
 
 Semaphore (const Semaphore &&)=delete
 
Semaphoreoperator= (const Semaphore &)=delete
 
 ~Semaphore () noexcept
 
size_t available ()
 
bool has_pending ()
 
void acquire ()
 
void release ()
 
void wait_until_under_and_acquire (size_t sz)
 
void wait_until_under (size_t sz)
 
size_t wait_available ()
 
void wait_all ()
 

Private Attributes

std::mutex m_mutex
 
std::condition_variable m_cv
 
const size_t m_sz
 
size_t m_count
 

Detailed Description

Definition at line 16 of file Semaphore.h.

Constructor & Destructor Documentation

◆ Semaphore() [1/3]

SWC::Core::Semaphore::Semaphore ( size_t  sz = 1,
size_t  pre_acquire = 0 
)
explicitnoexcept

Definition at line 13 of file Semaphore.cc.

◆ Semaphore() [2/3]

SWC::Core::Semaphore::Semaphore ( const Semaphore )
delete

◆ Semaphore() [3/3]

SWC::Core::Semaphore::Semaphore ( const Semaphore &&  )
delete

◆ ~Semaphore()

SWC::Core::Semaphore::~Semaphore ( )
noexcept

Definition at line 17 of file Semaphore.cc.

Member Function Documentation

◆ acquire()

void SWC::Core::Semaphore::acquire ( )

◆ available()

size_t SWC::Core::Semaphore::available ( )

Definition at line 19 of file Semaphore.cc.

References m_count, m_mutex, and m_sz.

Referenced by SWC::Manager::MngdColumns::initialize().

+ Here is the caller graph for this function:

◆ has_pending()

bool SWC::Core::Semaphore::has_pending ( )

Definition at line 24 of file Semaphore.cc.

References m_count, and m_mutex.

◆ operator=()

Semaphore& SWC::Core::Semaphore::operator= ( const Semaphore )
delete

◆ release()

void SWC::Core::Semaphore::release ( )

Definition at line 36 of file Semaphore.cc.

References m_count, m_cv, and m_mutex.

Referenced by SWC::Manager::MngdColumns::initialize(), SWC::Ranger::CommitLog::Fragment::remove(), SWC::Ranger::CommitLog::Splitter::split(), and SWC::Ranger::CommitLog::Fragment::write().

+ Here is the caller graph for this function:

◆ wait_all()

void SWC::Core::Semaphore::wait_all ( )

◆ wait_available()

size_t SWC::Core::Semaphore::wait_available ( )

Definition at line 55 of file Semaphore.cc.

References m_count, m_cv, m_mutex, and m_sz.

Referenced by SWC::Ranger::CommitLog::Fragments::_commit().

+ Here is the caller graph for this function:

◆ wait_until_under()

void SWC::Core::Semaphore::wait_until_under ( size_t  sz)

Definition at line 49 of file Semaphore.cc.

References m_count, m_cv, and m_mutex.

◆ wait_until_under_and_acquire()

void SWC::Core::Semaphore::wait_until_under_and_acquire ( size_t  sz)

Definition at line 42 of file Semaphore.cc.

References m_count, m_cv, and m_mutex.

Member Data Documentation

◆ m_count

size_t SWC::Core::Semaphore::m_count
private

◆ m_cv

std::condition_variable SWC::Core::Semaphore::m_cv
private

◆ m_mutex

std::mutex SWC::Core::Semaphore::m_mutex
private

◆ m_sz

const size_t SWC::Core::Semaphore::m_sz
private

Definition at line 48 of file Semaphore.h.

Referenced by acquire(), available(), and wait_available().


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