SObjectizer  5.7
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
so_5::rw_spinlock_t< Backoff > Class Template Reference

A simple multi-readers/single-writer spinlock (analog of std::shared_mutex). More...

#include <spinlocks.hpp>

Public Member Functions

 rw_spinlock_t ()
 
 rw_spinlock_t (const rw_spinlock_t &)=delete
 
rw_spinlock_toperator= (const rw_spinlock_t &)=delete
 
void lock_shared ()
 Lock object in shared mode. More...
 
void unlock_shared ()
 Unlock object locked in shared mode. More...
 
void lock ()
 Lock object in exclusive mode. More...
 
void unlock ()
 Unlock object locked in exclusive mode. More...
 

Private Attributes

std::atomic_uint_fast32_t m_counters
 

Static Private Attributes

static constexpr const std::uint_fast32_t unlocked = 0
 
static constexpr const std::uint_fast32_t write_lock = 1
 
static constexpr const std::uint_fast32_t read_lock = 2
 

Detailed Description

template<class Backoff>
class so_5::rw_spinlock_t< Backoff >

A simple multi-readers/single-writer spinlock (analog of std::shared_mutex).

Since
v.5.4.0

This implementation is based on Dmitry Vyukov implementation from LLVM code base: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc?revision=210345&view=markup

Constructor & Destructor Documentation

◆ rw_spinlock_t() [1/2]

template<class Backoff>
so_5::rw_spinlock_t< Backoff >::rw_spinlock_t ( )
inline

◆ rw_spinlock_t() [2/2]

template<class Backoff>
so_5::rw_spinlock_t< Backoff >::rw_spinlock_t ( const rw_spinlock_t< Backoff > &  )
delete

Member Function Documentation

◆ lock()

template<class Backoff>
void so_5::rw_spinlock_t< Backoff >::lock ( )
inline

Lock object in exclusive mode.

◆ lock_shared()

template<class Backoff>
void so_5::rw_spinlock_t< Backoff >::lock_shared ( )
inline

Lock object in shared mode.

◆ operator=()

template<class Backoff>
rw_spinlock_t& so_5::rw_spinlock_t< Backoff >::operator= ( const rw_spinlock_t< Backoff > &  )
delete

◆ unlock()

template<class Backoff>
void so_5::rw_spinlock_t< Backoff >::unlock ( )
inline

Unlock object locked in exclusive mode.

◆ unlock_shared()

template<class Backoff>
void so_5::rw_spinlock_t< Backoff >::unlock_shared ( )
inline

Unlock object locked in shared mode.

Member Data Documentation

◆ m_counters

template<class Backoff>
std::atomic_uint_fast32_t so_5::rw_spinlock_t< Backoff >::m_counters
private

◆ read_lock

template<class Backoff>
constexpr const std::uint_fast32_t so_5::rw_spinlock_t< Backoff >::read_lock = 2
staticprivate

◆ unlocked

template<class Backoff>
constexpr const std::uint_fast32_t so_5::rw_spinlock_t< Backoff >::unlocked = 0
staticprivate

◆ write_lock

template<class Backoff>
constexpr const std::uint_fast32_t so_5::rw_spinlock_t< Backoff >::write_lock = 1
staticprivate

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