- \p Key - key type
- \p T - the type stored in the map.
- \p Traits - map traits., default is \p cuckoo::traits.
- It is possible to declare option-based set with \p cuckoo::make_traits metafunction
+ It is possible to declare option-based set with \p cuckoo::make_traits metafunction
result as \p Traits template argument.
<b>Examples</b>
/// Key copy policy (for \p EllenBinTreeMap)
/**
The key copy policy defines a functor to copy leaf node's key to internal node.
- This policy is used only in \p EllenBinTreeMap.
+ This policy is used only in \p EllenBinTreeMap.
By default, assignment operator is used.
The copy functor interface is:
- \p opt::stat - internal statistics, by default disabled (\p ellen_bintree::empty_stat). To enable
it use \p ellen_bintree::stat.
- \p opt::backoff - back-off strategy, by default no strategy is used (\p cds::backoff::empty)
- - \p opt::rcu_check_deadlock - a deadlock checking policy, only for RCU-based tree.
+ - \p opt::rcu_check_deadlock - a deadlock checking policy, only for RCU-based tree.
Default is \p opt::v::rcu_throw_deadlock.
*/
template <typename... Options>
/// Skip list internal statistics
template <typename EventCounter = cds::atomicity::event_counter>
- using stat = cds::intrusive::skip_list::stat < EventCounter > ;
+ using stat = cds::intrusive::skip_list::stat < EventCounter >;
/// Skip list empty internal statistics
typedef cds::intrusive::skip_list::empty_stat empty_stat;
- \p opt::allocator - allocator for skip-list node. Default is \ref CDS_DEFAULT_ALLOCATOR.
- \p opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used.
- \p opt::stat - internal statistics. Available types: \p skip_list::stat, \p skip_list::empty_stat (the default)
- - \p opt::rcu_check_deadlock - a deadlock checking policy for RCU-based skip-list.
+ - \p opt::rcu_check_deadlock - a deadlock checking policy for RCU-based skip-list.
Default is \p opt::v::rcu_throw_deadlock
*/
/// pointer to extracted node
using exempt_ptr = cds::urcu::exempt_ptr < gc, leaf_node, value_type, typename maker::intrusive_traits::disposer,
cds::urcu::details::conventional_exempt_member_cast < leaf_node, value_type >
- > ;
+ >;
public:
/// Default constructor
\endcode
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
- The user-defined functor is called only if the inserting is success.
+ The user-defined functor is called only if the inserting is success.
RCU \p synchronize() can be called. RCU should not be locked.
*/
typedef Key key_type; ///< type of a key stored in the map
typedef T mapped_type; ///< type of value stored in the map
typedef std::pair< key_type const, mapped_type > value_type ; ///< Key-value pair stored in leaf node of the mp
- typedef Traits traits; ///< Map traits
+ typedef Traits traits; ///< Map traits
# ifdef CDS_DOXYGEN_INVOKED
typedef implementation_defined key_comparator; ///< key compare functor based on \p Traits::compare and \p Traits::less
- \p K - type of a key to be stored in the list.
- \p T - type of a value to be stored in the list.
- \p Traits - map traits, default is \p skip_list::traits
- It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction
+ It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction
istead of \p Traits template argument.
Like STL map class, \p %SkipListMap stores the key-value pair as <tt>std:pair< K const, T></tt>.
- \p GC - Garbage collector used.
- \p T - type to be stored in the list.
- \p Traits - set traits, default is \p skip_list::traits.
- It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction
+ It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction
istead of \p Traits template argument.
@warning The skip-list requires up to 67 hazard pointers that may be critical for some GCs for which
- \p K - type of a key to be stored in the map.
- \p T - type of a value to be stored in the map.
- \p Traits - map traits, default is \p skip_list::traits
- It is possible to declare option-based list with \p cds::container::skip_list::make_traits
+ It is possible to declare option-based list with \p cds::container::skip_list::make_traits
metafunction istead of \p Traits template argument.
*/
template <
/// Extracts an item with minimal key from the map
/**
- The function searches an item with minimal key, unlinks it,
+ The function searches an item with minimal key, unlinks it,
and returns \ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the item.
If the skip-list is empty the function returns an empty \p exempt_ptr.
/// Extracts an item with maximal key from the map
/**
- The function searches an item with maximal key, unlinks it from the set,
+ The function searches an item with maximal key, unlinks it from the set,
and returns \ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the item.
If the skip-list is empty the function returns an empty \p exempt_ptr.
/// Extracts an item with minimal key from the set
/**
- The function searches an item with minimal key, unlinks it,
+ The function searches an item with minimal key, unlinks it,
and returns \ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the item.
If the skip-list is empty the function returns an empty \p exempt_ptr.
/// Extracts an item with maximal key from the set
/**
- The function searches an item with maximal key, unlinks it from the set,
+ The function searches an item with maximal key, unlinks it from the set,
and returns \ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the item.
If the skip-list is empty the function returns an empty \p exempt_ptr.
If the option is not specified, the \p %opt::less is used.
- \p opt::less - specifies binary predicate used for key comparison. Default is \p std::less<T>.
- \p opt::item_counter - item counter type. Default is \p atomicity::item_counter since some operation on the counter is performed
- without locks. Note that item counting is an essential part of the map algorithm, so dummy counter
+ without locks. Note that item counting is an essential part of the map algorithm, so dummy counter
like as \p atomicity::empty_item_counter is not suitable.
- \p opt::allocator - the allocator type using for memory allocation of bucket table and lock array. Default is \ref CDS_DEFAULT_ALLOCATOR.
- \p opt::resizing_policy - the resizing policy that is a functor that decides when to resize the hash map.
- \p opt::mutex_policy - concurrent access policy.
Available policies: \p intrusive::striped_set::striping, \p intrusive::striped_set::refinable.
Default is \p %striped_set::striping.
- - \p opt::hash - hash functor. Default option value see <tt>opt::v::hash_selector<opt::none> </tt>
+ - \p opt::hash - hash functor. Default option value see <tt>opt::v::hash_selector<opt::none> </tt>
which selects default hash functor for your compiler.
- \p opt::compare - key comparison functor. No default functor is provided.
If the option is not specified, the \p %opt::less is used.
- \p opt::less - specifies binary predicate used for key comparison. Default is \p std::less<T>.
- \p opt::item_counter - item counter type. Default is \p atomicity::item_counter since some operation on the counter is performed
- without locks. Note that item counting is an essential part of the set algorithm, so dummy counter
+ without locks. Note that item counting is an essential part of the set algorithm, so dummy counter
like as \p atomicity::empty_item_counter is not suitable.
- \p opt::allocator - the allocator type using for memory allocation of bucket table and lock array. Default is \ref CDS_DEFAULT_ALLOCATOR.
- \p opt::resizing_policy - the resizing policy that is a functor that decides when to resize the hash set.
The capacity is constant for any thread. It is defined by cds::gc::hp::GarbageCollector.
*/
size_t capacity() const CDS_NOEXCEPT
- {
- return m_arr.capacity();
+ {
+ return m_arr.capacity();
}
/// Current vector size (count of retired pointers in the vector)
size_t size() const CDS_NOEXCEPT
- {
- return m_nSize;
+ {
+ return m_nSize;
}
/// Set vector size. Uses internally
/// Begin iterator
iterator begin() CDS_NOEXCEPT
- {
- return m_arr.begin();
+ {
+ return m_arr.begin();
}
/// End iterator
iterator end() CDS_NOEXCEPT
- {
- return m_arr.begin() + m_nSize ;
+ {
+ return m_arr.begin() + m_nSize;
}
/// Clears the vector. After clearing, size() == 0
/// Returns max Hazard Pointer count defined in construction time
size_t getHazardPointerCount() const CDS_NOEXCEPT
- {
- return m_nHazardPointerCount;
+ {
+ return m_nHazardPointerCount;
}
/// Returns max thread count defined in construction time
size_t getMaxThreadCount() const CDS_NOEXCEPT
- {
- return m_nMaxThreadCount;
+ {
+ return m_nMaxThreadCount;
}
/// Returns max size of retired objects array. It is defined in construction time
size_t getMaxRetiredPtrCount() const CDS_NOEXCEPT
- {
- return m_nMaxRetiredPtrCount;
+ {
+ return m_nMaxRetiredPtrCount;
}
// Internal statistics
/// Auto hp_guard.
/**
This class encapsulates Hazard Pointer guard to protect a pointer against deletion .
- It allocates one HP from thread's HP array in constructor and free the hazard pointer allocated
+ It allocates one HP from thread's HP array in constructor and free the hazard pointer allocated
in destructor.
*/
class guard
The function always returns \p true since the guard count is unlimited for
\p gc::DHP garbage collector.
*/
- static CDS_CONSTEXPR bool check_available_guards(
+ static CDS_CONSTEXPR bool check_available_guards(
#ifdef CDS_DOXYGEN_INVOKED
- size_t nCountNeeded,
+ size_t nCountNeeded,
#else
size_t,
#endif
A guard is the hazard pointer.
Additionally, the \p %Guard class manages allocation and deallocation of the hazard pointer
- A \p %Guard object is not copy- and move-constructible
+ A \p %Guard object is not copy- and move-constructible
and not copy- and move-assignable.
*/
class Guard : public hp::guard
/// Checks if count of hazard pointer is no less than \p nCountNeeded
/**
- If \p bRaiseException is \p true (that is the default), the function raises
+ If \p bRaiseException is \p true (that is the default), the function raises
an \p std::overflow_error exception "Too few hazard pointers"
if \p nCountNeeded is more than the count of hazard pointer per thread.
*/
/// Metafunction converting option list to \p CuckooSet traits
/**
Template argument list \p Options... are:
- - \p intrusive::opt::hook - hook used. Possible values are: \p cuckoo::base_hook, \p cuckoo::member_hook,
+ - \p intrusive::opt::hook - hook used. Possible values are: \p cuckoo::base_hook, \p cuckoo::member_hook,
\p cuckoo::traits_hook.
If the option is not specified, <tt>%cuckoo::base_hook<></tt> is used.
- \p opt::hash - hash functor tuple, mandatory option. At least, two hash functors should be provided. All hash functor
<b>How to use</b>
You should incorporate \p cuckoo::node into your struct \p T and provide
- appropriate \p cuckoo::traits::hook in your \p Traits template parameters.
+ appropriate \p cuckoo::traits::hook in your \p Traits template parameters.
Usually, for \p Traits you define a struct based on \p cuckoo::traits.
Example for base hook and list-based probe-set:
- \p Tag - a \ref cds_intrusive_hook_tag "tag"
*/
template <class GC, typename Tag = opt::none>
- class node
+ class node
{
public:
typedef GC gc; ///< Garbage collector
To enable it use \p atomicity::item_counter
- \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
or \p opt::v::sequential_consistent (sequentially consisnent memory model).
- - \p skip_list::random_level_generator - random level generator. Can be \p skip_list::xorshift,
+ - \p skip_list::random_level_generator - random level generator. Can be \p skip_list::xorshift,
\p skip_list::turbo_pascal (the default) or
user-provided one. See \p skip_list::random_level_generator option description for explanation.
- \p opt::allocator - although the skip-list is an intrusive container,
// ...
\endcode
- Instead of declaring \p set_traits type traits we can use option-based syntax with
+ Instead of declaring \p set_traits type traits we can use option-based syntax with
\p ellen_bintree::make_traits metafunction, for example:
\code
typedef cds::intrusive::EllenBinTree< gpb_rcu, std::string, Foo,
/// Extracts an item with minimal key from the tree
/**
- The function searches an item with minimal key, unlinks it, and returns
+ The function searches an item with minimal key, unlinks it, and returns
\ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the leftmost item.
If the tree is empty the function returns empty \p exempt_ptr.
/// Extracts an item with maximal key from the tree
/**
- The function searches an item with maximal key, unlinks it, and returns
+ The function searches an item with maximal key, unlinks it, and returns
\ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the rightmost item.
If the tree is empty the function returns empty \p exempt_ptr.
update_ptr updGP( res.updGrandParent.ptr() );
if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ),
- memory_model::memory_order_acquire, atomics::memory_order_relaxed ) )
+ memory_model::memory_order_acquire, atomics::memory_order_relaxed ) )
{
if ( help_delete( pOp ) )
break;
- \p T - type to be stored in the list. The type must be based on \p skip_list::node (for \p skip_list::base_hook)
or it must have a member of type \p skip_list::node (for \p skip_list::member_hook).
- \p Traits - skip-list traits, default is \p skip_list::traits.
- It is possible to declare option-based list with \p cds::intrusive::skip_list::make_traits metafunction istead of \p Traits
+ It is possible to declare option-based list with \p cds::intrusive::skip_list::make_traits metafunction istead of \p Traits
template argument.
@warning The skip-list requires up to 67 hazard pointers that may be critical for some GCs for which
/// Extracts an item with maximal key from the list
/**
- The function searches an item with maximal key, unlinks it, and returns the pointer to item
+ The function searches an item with maximal key, unlinks it, and returns the pointer to item
as \p guarded_ptr object.
If the skip-list is empty the function returns an empty \p guarded_ptr.
public:
/// pointer to extracted node
- using exempt_ptr = cds::urcu::exempt_ptr< gc, value_type, value_type, clear_and_dispose, void >;
+ using exempt_ptr = cds::urcu::exempt_ptr< gc, value_type, value_type, clear_and_dispose, void >;
protected:
//@cond
- \p T - type to be stored in the set. The type must be based on \p skip_list::node (for \p skip_list::base_hook)
or it must have a member of type \p skip_list::node (for \p skip_list::member_hook).
- \p Traits - type traits, default is \p skip_list::traits.
- It is possible to declare option-based list with \p cds::intrusive::skip_list::make_traits metafunction
+ It is possible to declare option-based list with \p cds::intrusive::skip_list::make_traits metafunction
istead of \p Traits template argument.
<b>Iterators</b>
- \p T - type to be stored in the list. The type must be based on \p skip_list::node (for \p skip_list::base_hook)
or it must have a member of type \p skip_list::node (for \p skip_list::member_hook).
- \p Traits - set traits, default is \p skip_list::traits
- It is possible to declare option-based list with \p cds::intrusive::skip_list::make_traits metafunction
+ It is possible to declare option-based list with \p cds::intrusive::skip_list::make_traits metafunction
instead of \p Traits template argument.
@note Before including <tt><cds/intrusive/skip_list_rcu.h></tt> you should include appropriate RCU header file,
Template arguments:
- \p Container - the container class that is used as bucket table entry. The \p Container class should support
an uniform interface described below.
- - \p Options - options
+ - \p Options - options
The \p %StripedSet class does not exactly dictate the type of container that should be used as a \p Container bucket.
- Instead, the class supports different intrusive container type for the bucket, for exampe,
+ Instead, the class supports different intrusive container type for the bucket, for exampe,
\p boost::intrusive::list, \p boost::intrusive::set and others.
Remember that \p %StripedSet class algorithm ensures sequential blocking access to its bucket through the mutex type you specify
- \p opt::mutex_policy - concurrent access policy.
Available policies: \p striped_set::striping, \p striped_set::refinable.
Default is \p %striped_set::striping.
- - \p cds::opt::hash - hash functor. Default option value see <tt>opt::v::hash_selector <opt::none></tt>
+ - \p cds::opt::hash - hash functor. Default option value see <tt>opt::v::hash_selector <opt::none></tt>
which selects default hash functor for your compiler.
- \p cds::opt::compare - key comparison functor. No default functor is provided.
If the option is not specified, the \p opt::less is used.
} // namespace details
#if CDS_COMPILER == CDS_COMPILER_INTEL && CDS_COMPILER_VERSION <= 1500
- template <typename T,
- typename O1, typename O2, typename O3, typename O4, typename O5,
- typename O6, typename O7, typename O8, typename O9, typename O10,
+ template <typename T,
+ typename O1, typename O2, typename O3, typename O4, typename O5,
+ typename O6, typename O7, typename O8, typename O9, typename O10,
typename... Options
>
class adapt < boost::intrusive::unordered_set< T, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10 >, Options... >
enum { padding = Padding & ~padding_flags };
public:
- static CDS_CONSTEXPR const size_t c_nPadding =
- static_cast<unsigned int>(padding) == static_cast<unsigned int>(cache_line_padding) ? cds::c_nCacheLineSize :
+ static CDS_CONSTEXPR const size_t c_nPadding =
+ static_cast<unsigned int>(padding) == static_cast<unsigned int>(cache_line_padding) ? cds::c_nCacheLineSize :
static_cast<unsigned int>(padding) == static_cast<unsigned int>(no_special_padding) ? 0 : padding;
static_assert( (c_nPadding & (c_nPadding - 1)) == 0, "Padding must be a power-of-two number" );
c_nPadding,
c_nPadding == 0,
sizeof( T ) < c_nPadding ? padding_datasize_less : sizeof( T ) == c_nPadding ? padding_datasize_equal : padding_datasize_greater,
- (Padding & padding_tiny_data_only) != 0
+ (Padding & padding_tiny_data_only) != 0
>::type type;
};
- \p NodeType - container's node type
- \p ValueType - value type stored in container's node. For intrusive containers it is the same as \p NodeType
- \p Disposer - a disposer functor
- - \p Cast - a functor for casting from \p NodeType to \p ValueType. For intrusive containers
+ - \p Cast - a functor for casting from \p NodeType to \p ValueType. For intrusive containers
the casting is usually disabled, i.e. \p Cast is \p void.
*/
template <
- Changed: guarded_ptr and exempt_ptr have move semantics now. The container's extract() and get()
member functions return the objects of that type.
- Changed: improved cds::gc::HP and cds::gc::DHP internal implementation
+ - Changed: map member function insert_key() has been renamed to insert_with()
1.6.0 23.09.2014
General release
CPPUNIT_CHECK( gp->first == nKey );
CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
gp.release();
-
+
gp = m.extract_with( wrapped_item( nKey ), wrapped_less());
CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
{
return std::hash<size_t>()( k.nKey );
}
-
+
template <>
struct hash<map2::key_thread>
{