Mixes for Privacy and Anonymity in the Internet
|
Public Types | |
typedef std::make_signed< std::size_t >::type | ssize_t |
Public Member Functions | |
AE_NO_TSAN | LightweightSemaphore (ssize_t initialCount=0) |
bool | tryWait () AE_NO_TSAN |
void | wait () AE_NO_TSAN |
bool | wait (std::int64_t timeout_usecs) AE_NO_TSAN |
void | signal (ssize_t count=1) AE_NO_TSAN |
ssize_t | availableApprox () const AE_NO_TSAN |
Private Member Functions | |
bool | waitWithPartialSpinning (std::int64_t timeout_usecs=-1) AE_NO_TSAN |
Private Attributes | |
weak_atomic< ssize_t > | m_count |
Semaphore | m_sema |
typedef std::make_signed<std::size_t>::type spsc_sema::LightweightSemaphore::ssize_t |
AE_NO_TSAN spsc_sema::LightweightSemaphore::LightweightSemaphore | ( | ssize_t | initialCount = 0 | ) |
ssize_t spsc_sema::LightweightSemaphore::availableApprox | ( | ) | const |
References weak_atomic< T >::load(), and m_count.
void spsc_sema::LightweightSemaphore::signal | ( | ssize_t | count = 1 | ) |
References weak_atomic< T >::fetch_add_release(), m_count, and m_sema.
bool spsc_sema::LightweightSemaphore::tryWait | ( | ) |
References weak_atomic< T >::fetch_add_acquire(), weak_atomic< T >::load(), and m_count.
Referenced by wait().
void spsc_sema::LightweightSemaphore::wait | ( | ) |
References tryWait(), and waitWithPartialSpinning().
bool spsc_sema::LightweightSemaphore::wait | ( | std::int64_t | timeout_usecs | ) |
References tryWait(), and waitWithPartialSpinning().
|
private |
References compiler_fence(), weak_atomic< T >::fetch_add_acquire(), weak_atomic< T >::fetch_add_release(), weak_atomic< T >::load(), m_count, m_sema, and memory_order_acquire.
Referenced by wait().
|
private |
Referenced by availableApprox(), signal(), tryWait(), and waitWithPartialSpinning().
|
private |
Referenced by signal(), and waitWithPartialSpinning().