Intel Threading Building Blocks 2.1 for Open Source

Public Member Functions

tbb::interface4::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor Class Reference

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

#include <concurrent_hash_map.h>

Inheritance diagram for tbb::interface4::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor:
Inheritance graph
[legend]

List of all members.

Public Member Functions

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
 bucket_accessor (concurrent_hash_map *base, const hashcode_t h, bool writer=false)
bool is_writer ()
 check whether bucket is locked for write
bucket * operator() ()
 get bucket pointer
bool upgrade_to_writer ()

Detailed Description

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

Definition at line 630 of file concurrent_hash_map.h.


Constructor & Destructor Documentation

template<typename Key , typename T , typename HashCompare , typename Allocator >
tbb::interface4::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 634 of file concurrent_hash_map.h.

: public bucket::scoped_t {


Member Function Documentation

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

Definition at line 636 of file concurrent_hash_map.h.

References tbb::acquire.

          :
        bucket_accessor( concurrent_hash_map *base, const hashcode_t h, bool writer = false ) { acquire( base, h, writer ); }
        inline void acquire( concurrent_hash_map *base, const hashcode_t h, bool writer = false ) {
            my_b = base->get_bucket( h );
#if TBB_USE_THREADING_TOOLS
            // TODO: actually, notification is unnecessary here, just hiding double-check
            if( itt_load_pointer_with_acquire_v3(&my_b->node_list) == internal::rehash_req
#else
            if( __TBB_load_with_acquire(my_b->node_list) == internal::rehash_req
#endif
                && try_acquire( my_b->mutex, /*write=*/true ) )
            {
                if( my_b->node_list == internal::rehash_req ) base->rehash_bucket( my_b, h ); //recursive rehashing
                my_is_writer = true;

template<typename Key , typename T , typename HashCompare , typename Allocator >
bool tbb::interface4::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::is_writer (  )  [inline]
template<typename Key , typename T , typename HashCompare , typename Allocator >
bucket* tbb::interface4::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::operator() (  )  [inline]

Definition at line 655 of file concurrent_hash_map.h.

{ return my_is_writer; }

template<typename Key , typename T , typename HashCompare , typename Allocator >
bool tbb::interface4::concurrent_hash_map< Key, T, HashCompare, Allocator >::bucket_accessor::upgrade_to_writer (  )  [inline]

Definition at line 657 of file concurrent_hash_map.h.

Referenced by tbb::interface4::concurrent_hash_map< Key, T, HashCompare, Allocator >::lookup().

{ return my_is_writer; }


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

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

Licensed under the GNU General Public License 2 with the runtime exception.

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.