cds
2.3.2
|
Refinable 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 BackOff | back_off |
back-off strategy | |
typedef Stat | statistics_type |
internal statistics type | |
Public Member Functions | |
refinable (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 refinable mutex policy. | |
statistics_type const & | statistics () const |
Returns internal statistics. | |
Static Public Attributes | |
static unsigned int const | c_nArity = Arity |
the arity | |
Refinable concurrent access policy.
This is one of available opt::mutex_policy
option type for CuckooSet
Refining is like a striping technique (see cuckoo::striping
) but it allows growing the size of lock array when resizing the hash table. So, the sizes of hash table and lock array are equal.
Template arguments:
RecursiveLock
- the type of mutex. Reentrant (recursive) mutex is required. The default is std::recursive_mutex
. The mutex type should be default-constructible.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.BackOff
- back-off strategy. Default is cds::backoff::Default
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.
|
inline |
Constructor.
nLockCount | The size of lock array. Must be power of two. |
|
inline |
Returns lock array size.
Lock array size is not a constant for refinable
policy and can be changed when the set is resized.