cds  2.3.2
cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat > Class Template Reference

Lock striping concurrent access policy. More...

#include <cds/intrusive/cuckoo_set.h>

Public Types

typedef RecursiveLock lock_type
 lock type
 
typedef Alloc allocator_type
 allocator type
 
typedef Stat statistics_type
 Internal statistics type (striping_stat or empty_striping_stat)
 
typedef cds::sync::lock_array< lock_type, cds::sync::pow2_select_policy, allocator_typelock_array_type
 lock array type
 

Public Member Functions

 striping (size_t nLockCount)
 Constructor. More...
 
size_t lock_count () const
 Returns lock array size. More...
 
constexpr unsigned int arity () const noexcept
 Returns the arity of striping mutex policy.
 
statistics_type const & statistics () const
 Returns internal statistics.
 

Static Public Attributes

static unsigned int const c_nArity = Arity
 the arity
 

Detailed Description

template<class RecursiveLock = std::recursive_mutex, unsigned int Arity = 2, class Alloc = CDS_DEFAULT_ALLOCATOR, class Stat = empty_striping_stat>
class cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat >

Lock striping concurrent access policy.

This is one of available opt::mutex_policy option type for CuckooSet

Lock striping is very simple technique. The cuckoo set consists of the bucket tables and the array of locks. There is single lock array for each bucket table, at least, the count of bucket table is 2. Initially, the capacity of lock array and each bucket table is the same. When set is resized, bucket table capacity will be doubled but lock array will not. The lock i protects each bucket j, where j = i mod L , where L - the size of lock array.

The policy contains an internal array of RecursiveLock locks.

Template arguments:

  • RecursiveLock - the type of recursive mutex. The default is std::recursive_mutex. The mutex type should be default-constructible. Note that a recursive spin-lock is not suitable for lock striping for performance reason.
  • Arity - unsigned int constant that specifies an arity. The arity is the count of hash functors, i.e., the count of lock arrays. Default value is 2.
  • Alloc - allocator type used for lock array memory allocation. Default is CDS_DEFAULT_ALLOCATOR.
  • Stat - internal statistics type. Note that this template argument is automatically selected by CuckooSet class according to its opt::stat option.

Constructor & Destructor Documentation

◆ striping()

template<class RecursiveLock = std::recursive_mutex, unsigned int Arity = 2, class Alloc = CDS_DEFAULT_ALLOCATOR, class Stat = empty_striping_stat>
cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat >::striping ( size_t  nLockCount)
inline

Constructor.

Parameters
nLockCountThe size of lock array. Must be power of two.

Member Function Documentation

◆ lock_count()

template<class RecursiveLock = std::recursive_mutex, unsigned int Arity = 2, class Alloc = CDS_DEFAULT_ALLOCATOR, class Stat = empty_striping_stat>
size_t cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat >::lock_count ( ) const
inline

Returns lock array size.

Lock array size is unchanged during striping object lifetime


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

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:41 by Doxygen 1.8.13