cds  1.4.0
Data Structures | Public Member Functions | Static Public Member Functions
cds::gc::HRC::GuardArray< Limit > Class Template Reference

Array of guards. More...

#include <cds/gc/hrc.h>

Inheritance diagram for cds::gc::HRC::GuardArray< Limit >:
cds::gc::hrc::AutoHPArray< Limit >

Data Structures

struct  rebind
 Rebind array for other size OtherLimit. More...
 

Public Member Functions

template<typename T >
T * protect (size_t nIndex, atomic_ref< T > const &link)
 Protects an atomic reference link in slot nIndex. More...
 
template<typename T >
atomic_marked_ptr< T >::marked_ptr protect (size_t nIndex, atomic_marked_ptr< T > const &link)
 Protects a atomic marked reference link in slot nIndex. More...
 
template<typename T , class Func >
T * protect (size_t nIndex, atomic_ref< T > const &toGuard, Func f)
 Protects a pointer of type atomic<T*> More...
 
template<typename T , typename Func >
atomic_marked_ptr< T >::marked_ptr protect (size_t nIndex, atomic_marked_ptr< T > const &link, Func f)
 Protects a atomic marked reference link in slot nIndex. More...
 
template<typename T >
T * assign (size_t nIndex, T *p)
 Store to the slot nIndex. More...
 
template<typename T , int Bitmask>
T * assign (size_t nIndex, cds::details::marked_ptr< T, Bitmask > p)
 Store marked pointer p to the guard. More...
 
void copy (size_t nIndex, Guard const &src)
 Copy guarded value from src guard to slot at index nIndex.
 
void copy (size_t nDestIndex, size_t nSrcIndex)
 Copy guarded value from slot nSrcIndex to slot at index nDestIndex.
 
void clear (size_t nIndex)
 Clear value of the slot nIndex.
 
template<typename T >
T * get (size_t nIndex) const
 Get current value of slot nIndex.
 
guarded_pointer get_native (size_t nIndex) const
 Get native hazard pointer stored.
 
- Public Member Functions inherited from cds::gc::hrc::AutoHPArray< Limit >
 AutoHPArray (ThreadGC &mgr)
 Allocates array of HP guard from mgr.
 
 ~AutoHPArray ()
 Frees array of HP guard.
 
ThreadGCgetGC () const
 Returns thread GC.
 

Static Public Member Functions

static constexpr size_t capacity ()
 Capacity of the guard array.
 

Detailed Description

template<size_t Limit>
class cds::gc::HRC::GuardArray< Limit >

Array of guards.

This class is a wrapper for AutoHPArray template. Template parameter Limit defines the size of HP array.

Member Function Documentation

template<size_t Limit>
template<typename T >
T* cds::gc::HRC::GuardArray< Limit >::assign ( size_t  nIndex,
T *  p 
)
inline

Store to the slot nIndex.

The function equals to a simple assignment, no loop is performed.

template<size_t Limit>
template<typename T , int Bitmask>
T* cds::gc::HRC::GuardArray< Limit >::assign ( size_t  nIndex,
cds::details::marked_ptr< T, Bitmask >  p 
)
inline

Store marked pointer p to the guard.

The function equals to a simple assignment of p.ptr(), no loop is performed. Can be used for a marked pointer that cannot be changed concurrently.

template<size_t Limit>
template<typename T >
T* cds::gc::HRC::GuardArray< Limit >::protect ( size_t  nIndex,
atomic_ref< T > const &  link 
)
inline

Protects an atomic reference link in slot nIndex.

Returns current value of link.

The function tries to load pToGuard and to store it to the slot nIndex repeatedly until the guard's value equals pToGuard

template<size_t Limit>
template<typename T >
atomic_marked_ptr<T>::marked_ptr cds::gc::HRC::GuardArray< Limit >::protect ( size_t  nIndex,
atomic_marked_ptr< T > const &  link 
)
inline

Protects a atomic marked reference link in slot nIndex.

Returns current value of link.

The function tries to load link and to store it to the slot nIndex repeatedly until the guard's value equals link

template<size_t Limit>
template<typename T , class Func >
T* cds::gc::HRC::GuardArray< Limit >::protect ( size_t  nIndex,
atomic_ref< T > const &  toGuard,
Func  f 
)
inline

Protects a pointer of type atomic<T*>

Return the value of toGuard

The function tries to load toGuard and to store it to the slot nIndex repeatedly until the guard's value equals toGuard

The function is useful for intrusive containers when toGuard is a node pointer that should be converted to a pointer to the value type before guarding. The parameter f of type Func is a functor that makes this conversion:

struct functor {
value_type * operator()( T * p ) ;
};

Really, the result of f( toGuard.load() ) is assigned to the hazard pointer.

template<size_t Limit>
template<typename T , typename Func >
atomic_marked_ptr<T>::marked_ptr cds::gc::HRC::GuardArray< Limit >::protect ( size_t  nIndex,
atomic_marked_ptr< T > const &  link,
Func  f 
)
inline

Protects a atomic marked reference link in slot nIndex.

Returns current value of link.

The function tries to load link and to store it to the slot nIndex repeatedly until the guard's value equals link

The function is useful for intrusive containers when link is a node pointer that should be converted to a pointer to the value type before guarding. The parameter f of type Func is a functor that makes this conversion:

struct functor {
value_type * operator()( T p ) ;
};

Really, the result of f( link.load() ) is assigned to the hazard pointer.


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

cds 1.4.0 Developed by Maxim Khiszinsky aka khizmax 2007 - 2012
Autogenerated Mon May 20 2013 00:37:58 by Doxygen 1.8.3.1