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...
bucket * | operator() ()
| get bucket pointer More...

## Private Attributes

bucket * | my_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.

{ acquire( base, h, writer ); }
h
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
Definition: ittnotify_static.h:159
tbb::interface5::concurrent_hash_map::bucket_accessor::acquire
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
Definition: concurrent_hash_map.h:705

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.

{
my_b = base->get_bucket( h );
// TODO: actually, notification is unnecessary here, just hiding double-check
if( itt_load_word_with_acquire(my_b->node_list) == internal::rehash_req
&& try_acquire( my_b->mutex, /*write=*/true ) )
{
if( my_b->node_list == internal::rehash_req ) base->rehash_bucket( my_b, h ); //recursive rehashing
}
else bucket::scoped_t::acquire( my_b->mutex, writer );
__TBB_ASSERT( my_b->node_list != internal::rehash_req, NULL);
}
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::acquire
@ acquire
Acquire.
Definition: atomic.h:57
tbb::internal::itt_load_word_with_acquire
T itt_load_word_with_acquire(const tbb::atomic< T > &src)
Definition: tbb_profiling.h:168
tbb::interface5::internal::rehash_req
static hash_map_node_base *const rehash_req
Incompleteness flag value.
Definition: concurrent_hash_map.h:78
tbb::interface5::internal::hash_map_base::bucket::mutex
mutex_t mutex
Definition: concurrent_hash_map.h:98
tbb::interface5::internal::hash_map_base::bucket::node_list
node_base * node_list
Definition: concurrent_hash_map.h:99
tbb::interface5::concurrent_hash_map::bucket_accessor::my_b
bucket * my_b
Definition: concurrent_hash_map.h:701

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.

{ 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

get bucket pointer

Definition at line 719 of file concurrent_hash_map.h.

{ return my_b; }

References tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::my_b.

## 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

Definition at line 701 of file concurrent_hash_map.h.

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

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

- concurrent_hash_map.h

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.