Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor Class Reference

bucket accessor is to find, rehash, acquire a lock, and access a bucket More...

#include <concurrent_hash_map.h>

Inheritance diagram for tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor:
Collaboration diagram for tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor:

Public Member Functions

 bucket_accessor (concurrent_hash_map *base, const hashcode_t h, bool writer=false)
 
void acquire (concurrent_hash_map *base, const hashcode_t h, bool writer=false)
 find a bucket by masked hashcode, optionally rehash, and acquire the lock More...
 
bool is_writer ()
 check whether bucket is locked for write More...
 
bucketoperator() ()
 get bucket pointer More...
 

Private Attributes

bucketmy_b
 

Detailed Description

template<typename Key, typename T, typename HashCompare, typename Allocator>
class tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor

bucket accessor is to find, rehash, acquire a lock, and access a bucket

Definition at line 700 of file concurrent_hash_map.h.

Constructor & Destructor Documentation

◆ bucket_accessor()

template<typename Key, typename T, typename HashCompare, typename Allocator>
tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::bucket_accessor ( concurrent_hash_map base,
const hashcode_t  h,
bool  writer = false 
)
inline

Definition at line 703 of file concurrent_hash_map.h.

703 { acquire( base, h, writer ); }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function h
void acquire(concurrent_hash_map *base, const hashcode_t h, bool writer=false)
find a bucket by masked hashcode, optionally rehash, and acquire the lock

References tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::acquire(), and h.

Here is the call graph for this function:

Member Function Documentation

◆ acquire()

template<typename Key, typename T, typename HashCompare, typename Allocator>
void tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::acquire ( concurrent_hash_map base,
const hashcode_t  h,
bool  writer = false 
)
inline

find a bucket by masked hashcode, optionally rehash, and acquire the lock

Definition at line 705 of file concurrent_hash_map.h.

705  {
706  my_b = base->get_bucket( h );
707  // TODO: actually, notification is unnecessary here, just hiding double-check
709  && try_acquire( my_b->mutex, /*write=*/true ) )
710  {
711  if( my_b->node_list == internal::rehash_req ) base->rehash_bucket( my_b, h ); //recursive rehashing
712  }
713  else bucket::scoped_t::acquire( my_b->mutex, writer );
715  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function h
static hash_map_node_base *const rehash_req
Incompleteness flag value.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
T itt_load_word_with_acquire(const tbb::atomic< T > &src)
Acquire.
Definition: atomic.h:57

References __TBB_ASSERT, tbb::acquire, tbb::interface5::internal::hash_map_base::get_bucket(), h, tbb::internal::itt_load_word_with_acquire(), tbb::interface5::internal::hash_map_base::bucket::mutex, tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::my_b, tbb::interface5::internal::hash_map_base::bucket::node_list, tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::rehash_bucket(), and tbb::interface5::internal::rehash_req.

Referenced by tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::bucket_accessor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_writer()

template<typename Key, typename T, typename HashCompare, typename Allocator>
bool tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::is_writer ( )
inline

check whether bucket is locked for write

Definition at line 717 of file concurrent_hash_map.h.

717 { return bucket::scoped_t::is_writer; }

Referenced by tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::erase(), tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::lookup(), and tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::rehash_bucket().

Here is the caller graph for this function:

◆ operator()()

template<typename Key, typename T, typename HashCompare, typename Allocator>
bucket* tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::operator() ( )
inline

Member Data Documentation

◆ my_b

template<typename Key, typename T, typename HashCompare, typename Allocator>
bucket* tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::my_b
private

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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.