proxygen
folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets Class Reference

#include <ConcurrentHashMap-detail.h>

Inheritance diagram for folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets:
folly::hazptr_obj_base< Buckets, Atom, concurrenthashmap::HazptrBucketDeleter< Allocator > > folly::hazptr_obj< Atom > folly::hazptr_deleter< Buckets, concurrenthashmap::HazptrBucketDeleter< Allocator > >

Public Member Functions

void destroy (size_t count)
 
void unlink_and_reclaim_nodes (size_t count)
 
- Public Member Functions inherited from folly::hazptr_obj_base< Buckets, Atom, concurrenthashmap::HazptrBucketDeleter< Allocator > >
void retire (concurrenthashmap::HazptrBucketDeleter< Allocator >deleter={}, hazptr_domain< Atom > &domain=default_hazptr_domain< Atom >())
 
void retire (hazptr_domain< Atom > &domain)
 
- Public Member Functions inherited from folly::hazptr_obj< Atom >
 hazptr_obj () noexcept
 
 hazptr_obj (const hazptr_obj< Atom > &) noexcept
 
 hazptr_obj (hazptr_obj< Atom > &&) noexcept
 
hazptr_obj< Atom > & operator= (const hazptr_obj< Atom > &) noexcept
 
hazptr_obj< Atom > & operator= (hazptr_obj< Atom > &&) noexcept
 
- Public Member Functions inherited from folly::hazptr_deleter< Buckets, concurrenthashmap::HazptrBucketDeleter< Allocator > >
void set_deleter (concurrenthashmap::HazptrBucketDeleter< Allocator >d={})
 
void delete_obj (Buckets *p)
 

Static Public Member Functions

static Bucketscreate (size_t count)
 

Public Attributes

BucketRoot buckets_ [0]
 

Private Types

using BucketRoot = hazptr_root< Node, Atom >
 

Private Member Functions

 Buckets ()
 
 ~Buckets ()
 

Detailed Description

template<typename KeyType, typename ValueType, uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
class folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets

Definition at line 650 of file ConcurrentHashMap-detail.h.

Member Typedef Documentation

template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
using folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::BucketRoot = hazptr_root<Node, Atom>
private

Definition at line 654 of file ConcurrentHashMap-detail.h.

Constructor & Destructor Documentation

template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::Buckets ( )
inlineprivate

Definition at line 656 of file ConcurrentHashMap-detail.h.

656 {}
template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::~Buckets ( )
inlineprivate

Definition at line 657 of file ConcurrentHashMap-detail.h.

657 {}

Member Function Documentation

template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
static Buckets* folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::create ( size_t  count)
inlinestatic

Definition at line 660 of file ConcurrentHashMap-detail.h.

References count, and i.

660  {
661  auto buf =
662  Allocator().allocate(sizeof(Buckets) + sizeof(BucketRoot) * count);
663  auto buckets = new (buf) Buckets();
664  for (size_t i = 0; i < count; i++) {
665  new (&buckets->buckets_[i]) BucketRoot;
666  }
667  return buckets;
668  }
int * count
template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
void folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::destroy ( size_t  count)
inline

Definition at line 670 of file ConcurrentHashMap-detail.h.

References count, i, and uint8_t.

670  {
671  for (size_t i = 0; i < count; i++) {
672  buckets_[i].~BucketRoot();
673  }
674  this->~Buckets();
675  Allocator().deallocate(
676  (uint8_t*)this, sizeof(BucketRoot) * count + sizeof(*this));
677  }
int * count
template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
void folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::unlink_and_reclaim_nodes ( size_t  count)
inline

Definition at line 679 of file ConcurrentHashMap-detail.h.

References count, i, deadlock::load(), and cpp.ast::next().

679  {
680  for (size_t i = 0; i < count; i++) {
681  auto node = buckets_[i]().load(std::memory_order_relaxed);
682  if (node) {
683  buckets_[i]().store(nullptr, std::memory_order_relaxed);
684  while (node) {
685  auto next = node->next_.load(std::memory_order_relaxed);
686  if (next) {
687  node->next_.store(nullptr, std::memory_order_relaxed);
688  }
689  node->unlink_and_reclaim_unchecked();
690  node = next;
691  }
692  }
693  }
694  }
def load()
Definition: deadlock.py:441
int * count
hazptr_obj< Atom > * next() const noexcept
Definition: HazptrObj.h:86

Member Data Documentation

template<typename KeyType , typename ValueType , uint8_t ShardBits = 0, typename HashFn = std::hash<KeyType>, typename KeyEqual = std::equal_to<KeyType>, typename Allocator = std::allocator<uint8_t>, template< typename > class Atom = std::atomic, class Mutex = std::mutex>
BucketRoot folly::detail::ConcurrentHashMapSegment< KeyType, ValueType, ShardBits, HashFn, KeyEqual, Allocator, Atom, Mutex >::Buckets::buckets_[0]

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