A library for working with phylogenetic and population genetic data.
v0.32.0
LightweightSemaphore Class Reference

#include <genesis/utils/threading/lightweight_semaphore.hpp>

Detailed Description

Definition at line 323 of file lightweight_semaphore.hpp.

Public Member Functions

 LightweightSemaphore (ssize_t initialCount=0, int maxSpins=10000)
 
std::size_t availableApprox () const
 
void signal (ssize_t count=1)
 
bool tryWait ()
 
ssize_t tryWaitMany (ssize_t max)
 
bool wait ()
 
bool wait (std::int64_t timeout_usecs)
 
ssize_t waitMany (ssize_t max)
 
ssize_t waitMany (ssize_t max, std::int64_t timeout_usecs)
 

Public Types

typedef std::make_signed< std::size_t >::type ssize_t
 

Constructor & Destructor Documentation

◆ LightweightSemaphore()

LightweightSemaphore ( ssize_t  initialCount = 0,
int  maxSpins = 10000 
)
inline

Definition at line 397 of file lightweight_semaphore.hpp.

Member Function Documentation

◆ availableApprox()

std::size_t availableApprox ( ) const
inline

Definition at line 465 of file lightweight_semaphore.hpp.

◆ signal()

void signal ( ssize_t  count = 1)
inline

Definition at line 455 of file lightweight_semaphore.hpp.

◆ tryWait()

bool tryWait ( )
inline

Definition at line 405 of file lightweight_semaphore.hpp.

◆ tryWaitMany()

ssize_t tryWaitMany ( ssize_t  max)
inline

Definition at line 426 of file lightweight_semaphore.hpp.

◆ wait() [1/2]

bool wait ( )
inline

Definition at line 415 of file lightweight_semaphore.hpp.

◆ wait() [2/2]

bool wait ( std::int64_t  timeout_usecs)
inline

Definition at line 420 of file lightweight_semaphore.hpp.

◆ waitMany() [1/2]

ssize_t waitMany ( ssize_t  max)
inline

Definition at line 448 of file lightweight_semaphore.hpp.

◆ waitMany() [2/2]

ssize_t waitMany ( ssize_t  max,
std::int64_t  timeout_usecs 
)
inline

Definition at line 439 of file lightweight_semaphore.hpp.

Member Typedef Documentation

◆ ssize_t

typedef std::make_signed<std::size_t>::type ssize_t

Definition at line 325 of file lightweight_semaphore.hpp.


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