From fc398f44f1bc94c708bcdfba0b901b8fa847c3c5 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 30 Aug 2015 12:45:28 +0300 Subject: [PATCH] EllenBinTreeMap, EllenBinTreeSet: - replaced ensure() with update() - replaced find( key ) with contains( key ) MapDelOdd MT-test was refactored for EllenBinTreeMap --- cds/container/ellen_bintree_map_rcu.h | 75 +++++++++++++------- cds/container/ellen_bintree_set_rcu.h | 85 ++++++++++++++--------- cds/container/impl/ellen_bintree_map.h | 74 +++++++++++++------- cds/container/impl/ellen_bintree_set.h | 76 ++++++++++++-------- cds/intrusive/ellen_bintree_rcu.h | 63 ++++++++++++----- cds/intrusive/impl/ellen_bintree.h | 64 +++++++++++------ projects/Win/vc12/unit-map-delodd.vcxproj | 2 +- tests/unit/map2/map_defs.h | 57 +++++---------- tests/unit/map2/map_delodd.h | 3 +- tests/unit/map2/map_delodd_ellentree.cpp | 10 +-- tests/unit/map2/map_type_ellen_bintree.h | 61 ++++++++++------ tests/unit/map2/map_type_skip_list.h | 2 +- 12 files changed, 345 insertions(+), 227 deletions(-) diff --git a/cds/container/ellen_bintree_map_rcu.h b/cds/container/ellen_bintree_map_rcu.h index 3d43f614..78abba6b 100644 --- a/cds/container/ellen_bintree_map_rcu.h +++ b/cds/container/ellen_bintree_map_rcu.h @@ -225,19 +225,13 @@ namespace cds { namespace container { return false; } - /// Ensures that the \p key exists in the map + /// Updates the node /** The operation performs inserting or changing data with lock-free manner. - If the \p key not found in the map, then the new item created from \p key - is inserted into the map (note that in this case the \p key_type should be - constructible from type \p K). + If the item \p val is not found in the map, then \p val is inserted iff \p bAllowInsert is \p true. Otherwise, the functor \p func is called with item found. - The functor \p Func may be a function with signature: - \code - void func( bool bNew, value_type& item ); - \endcode - or a functor: + The functor \p func signature is: \code struct my_functor { void operator()( bool bNew, value_type& item ); @@ -246,29 +240,41 @@ namespace cds { namespace container { with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - - \p item - item of the tree + - \p item - item of the map - The functor may change any fields of the \p item.second that is \p value_type. + The functor may change any fields of the \p item.second that is \p mapped_type; + however, \p func must guarantee that during changing no any other modifications + could be made on this item by concurrent threads. RCU \p synchronize() method can be called. RCU should not be locked. - Returns std::pair where \p first is \p true if operation is successfull, + Returns std::pair where \p first is \p true if operation is successfull, + i.e. the node has been inserted or updated, \p second is \p true if new item has been added or \p false if the item with \p key - already is in the tree. + already exists. @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - std::pair ensure( K const& key, Func func ) + std::pair update( K const& key, Func func, bool bAllowInsert = true ) { scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key )); - std::pair res = base_class::ensure( *pNode, - [&func](bool bNew, leaf_node& item, leaf_node const& ){ func( bNew, item.m_Value ); } + std::pair res = base_class::update( *pNode, + [&func](bool bNew, leaf_node& item, leaf_node const& ){ func( bNew, item.m_Value ); }, + bAllowInsert ); if ( res.first && res.second ) pNode.release(); return res; } + //@cond + // Deprecated, use update() + template + std::pair ensure( K const& key, Func func ) + { + return update( key, func, true ); + } + //@endcond /// Delete \p key from the map /**\anchor cds_nonintrusive_EllenBinTreeMap_rcu_erase_val @@ -448,33 +454,48 @@ namespace cds { namespace container { [&f](leaf_node& item, K const& ) { f( item.m_Value );}); } - /// Find the key \p key - /** \anchor cds_nonintrusive_EllenBinTreeMap_rcu_find_val - + /// Checks whether the map contains \p key + /** The function searches the item with key equal to \p key and returns \p true if it is found, and \p false otherwise. The function applies RCU lock internally. */ template + bool contains( K const& key ) + { + return base_class::contains( key ); + } + //@cond + // Deprecated, use contains() + template bool find( K const& key ) { - return base_class::find( key ); + return contains( key ); } + //@endcond - /// Finds the key \p val using \p pred predicate for searching + /// Checks whether the map contains \p key using \p pred predicate for searching /** - The function is an analog of \ref cds_nonintrusive_EllenBinTreeMap_rcu_find_val "find(K const&)" - but \p pred is used for key comparing. - \p Less functor has the interface like \p std::less. - \p Less must imply the same element order as the comparator used for building the map. + The function is similar to contains( key ) but \p pred is used for key comparing. + \p Less functor has the interface like \p std::less and should meet \ref cds_intrusive_EllenBinTree_rcu_less + "Predicate requirements". + \p Less must imply the same element order as the comparator used for building the set. */ template - bool find_with( K const& key, Less pred ) + bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::find_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ); } + //@cond + // Deprecated, use contains() + template + bool find_with( K const& key, Less pred ) + { + return contains( key, pred ); + } + //@endcond /// Finds \p key and return the item found /** \anchor cds_nonintrusive_EllenBinTreeMap_rcu_get diff --git a/cds/container/ellen_bintree_set_rcu.h b/cds/container/ellen_bintree_set_rcu.h index ecf292b2..e9ac66f2 100644 --- a/cds/container/ellen_bintree_set_rcu.h +++ b/cds/container/ellen_bintree_set_rcu.h @@ -215,49 +215,53 @@ namespace cds { namespace container { return false; } - /// Ensures that the item exists in the set + /// Updates the node /** The operation performs inserting or changing data with lock-free manner. - If the \p val key not found in the set, then the new item created from \p val - is inserted into the set. Otherwise, the functor \p func is called with the item found. - The functor \p Func should be a function with signature: + If the item \p val is not found in the set, then \p val is inserted into the set + iff \p bAllowInsert is \p true. + Otherwise, the functor \p func is called with item found. + The functor \p func signature is: \code - void func( bool bNew, value_type& item, const Q& val ); + void func( bool bNew, value_type& item, value_type& val ); \endcode - or a functor: - \code - struct my_functor { - void operator()( bool bNew, value_type& item, const Q& val ); - }; - \endcode - with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - \p item - item of the set - - \p val - argument \p key passed into the \p ensure function + - \p val - argument \p val passed into the \p %update() function - The functor may change non-key fields of the \p item; however, \p func must guarantee + The functor can change non-key fields of the \p item; however, \p func must guarantee that during changing no any other modifications could be made on this item by concurrent threads. - RCU \p synchronize() can be called. RCU should not be locked. + RCU \p synchronize method can be called. RCU should not be locked. - Returns std::pair where \p first is true if operation is successfull, - \p second is true if new item has been added or \p false if the item with \p key - already is in the set. + Returns std::pair where \p first is \p true if operation is successfull, + i.e. the node has been inserted or updated, + \p second is \p true if new item has been added or \p false if the item with \p key + already exists. @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - std::pair ensure( const Q& val, Func func ) + std::pair update( Q const& val, Func func, bool bAllowInsert = true ) { scoped_node_ptr sp( cxx_leaf_node_allocator().New( val )); - std::pair bRes = base_class::ensure( *sp, - [&func, &val](bool bNew, leaf_node& node, leaf_node&){ func( bNew, node.m_Value, val ); }); + std::pair bRes = base_class::update( *sp, + [&func, &val](bool bNew, leaf_node& node, leaf_node&){ func( bNew, node.m_Value, val ); }, + bAllowInsert ); if ( bRes.first && bRes.second ) sp.release(); return bRes; } + //@cond + // Deprecated, use update() + template + std::pair ensure( const Q& val, Func func ) + { + return update( val, func true ); + } + //@endcond /// Inserts data of type \p value_type created in-place from \p args /** @@ -488,36 +492,49 @@ namespace cds { namespace container { } //@endcond - /// Find the key \p key - /** @anchor cds_nonintrusive_EllenBinTreeSet_rcu_find_val - + /// Checks whether the set contains \p key + /** The function searches the item with key equal to \p key and returns \p true if it is found, and \p false otherwise. - Note the hash functor specified for class \p Traits template parameter - should accept a parameter of type \p Q that may be not the same as \ref value_type. - The function applies RCU lock internally. */ template + bool contains( Q const& key ) const + { + return base_class::contains( key ); + } + //@cond + // Deprecated, use contains() + template bool find( Q const& key ) const { - return base_class::find( key ); + return contains( key ); } + //@endcond - /// Finds the key \p key using \p pred predicate for searching + /// Checks whether the set contains \p key using \p pred predicate for searching /** - The function is an analog of \ref cds_nonintrusive_EllenBinTreeSet_rcu_find_val "find(Q const&)" - but \p pred is used for key comparing. - \p Less functor has the interface like \p std::less. + The function is similar to contains( key ) but \p pred is used for key comparing. + \p Less functor has the interface like \p std::less and should meet \ref cds_intrusive_EllenBinTree_rcu_less + "Predicate requirements". \p Less must imply the same element order as the comparator used for building the set. + \p pred should accept arguments of type \p Q, \p key_type, \p value_type in any combination. */ template - bool find_with( Q const& key, Less pred ) const + bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - return base_class::find_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >()); + return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >()); + } + //@cond + // DEprecated, use contains() + template + bool find_with( Q const& key, Less pred ) const + { + return contains( key, pred ); } + //@endcond /// Finds \p key and return the item found /** \anchor cds_nonintrusive_EllenBinTreeSet_rcu_get diff --git a/cds/container/impl/ellen_bintree_map.h b/cds/container/impl/ellen_bintree_map.h index 1c8a3a01..7aa799cd 100644 --- a/cds/container/impl/ellen_bintree_map.h +++ b/cds/container/impl/ellen_bintree_map.h @@ -218,19 +218,13 @@ namespace cds { namespace container { return false; } - /// Ensures that the \p key exists in the map + /// Updates the node /** The operation performs inserting or changing data with lock-free manner. - If the \p key not found in the map, then the new item created from \p key - is inserted into the map (note that in this case the \ref key_type should be - constructible from type \p K). + If the item \p val is not found in the map, then \p val is inserted iff \p bAllowInsert is \p true. Otherwise, the functor \p func is called with item found. - The functor \p Func may be a function with signature: - \code - void func( bool bNew, value_type& item ); - \endcode - or a functor: + The functor \p func signature is: \code struct my_functor { void operator()( bool bNew, value_type& item ); @@ -239,27 +233,39 @@ namespace cds { namespace container { with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - - \p item - item of the list + - \p item - item of the map - The functor may change any fields of the \p item.second that is \ref value_type. + The functor may change any fields of the \p item.second that is \ref mapped_type; + however, \p func must guarantee that during changing no any other modifications + could be made on this item by concurrent threads. - Returns std::pair where \p first is true if operation is successfull, - \p second is true if new item has been added or \p false if the item with \p key - already is in the list. + Returns std::pair where \p first is \p true if operation is successfull, + i.e. the node has been inserted or updated, + \p second is \p true if new item has been added or \p false if the item with \p key + already exists. @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - std::pair ensure( K const& key, Func func ) + std::pair update( K const& key, Func func, bool bAllowInsert = true ) { scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key )); - std::pair res = base_class::ensure( *pNode, - [&func](bool bNew, leaf_node& item, leaf_node const& ){ func( bNew, item.m_Value ); } + std::pair res = base_class::update( *pNode, + [&func](bool bNew, leaf_node& item, leaf_node const& ){ func( bNew, item.m_Value ); }, + bAllowInsert ); if ( res.first && res.second ) pNode.release(); return res; } + //@cond + // Deprecated, use update() + template + std::pair ensure( K const& key, Func func ) + { + return update( key, func, true ); + } + //@endcond /// Delete \p key from the map /**\anchor cds_nonintrusive_EllenBinTreeMap_erase_val @@ -436,31 +442,45 @@ namespace cds { namespace container { [&f](leaf_node& item, K const& ) { f( item.m_Value );}); } - /// Find the key \p key - /** \anchor cds_nonintrusive_EllenBinTreeMap_find_val - + /// Checks whether the map contains \p key + /** The function searches the item with key equal to \p key and returns \p true if it is found, and \p false otherwise. */ template + bool contains( K const& key ) + { + return base_class::contains( key ); + } + //@cond + // Deprecated, use contains() + template bool find( K const& key ) { - return base_class::find( key ); + return contains( key ); } + //@endcond - /// Finds the key \p val using \p pred predicate for searching + /// Checks whether the map contains \p key using \p pred predicate for searching /** - The function is an analog of \ref cds_nonintrusive_EllenBinTreeMap_find_val "find(K const&)" - but \p pred is used for key comparing. + The function is similar to contains( key ) but \p pred is used for key comparing. \p Less functor has the interface like \p std::less. - \p Less must imply the same element order as the comparator used for building the map. + \p Less must imply the same element order as the comparator used for building the set. */ template - bool find_with( K const& key, Less pred ) + bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::find_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ); } + //@cond + // Deprecated, use contains() + template + bool find_with( K const& key, Less pred ) + { + return contains( key, pred ); + } + //@endcond /// Finds \p key and returns the item found /** @anchor cds_nonintrusive_EllenBinTreeMap_get diff --git a/cds/container/impl/ellen_bintree_set.h b/cds/container/impl/ellen_bintree_set.h index 3eebc06d..381938fb 100644 --- a/cds/container/impl/ellen_bintree_set.h +++ b/cds/container/impl/ellen_bintree_set.h @@ -210,47 +210,54 @@ namespace cds { namespace container { return false; } - /// Ensures that the item exists in the set + /// Updates the node /** The operation performs inserting or changing data with lock-free manner. - If the \p val key not found in the set, then the new item created from \p val - is inserted into the set. Otherwise, the functor \p func is called with the item found. - The functor \p Func should be a function with signature: - \code - void func( bool bNew, value_type& item, const Q& val ); - \endcode - or a functor: + If the item \p val is not found in the set, then \p val is inserted into the set + iff \p bAllowInsert is \p true. + Otherwise, the functor \p func is called with item found. + The functor \p func signature is: \code struct my_functor { void operator()( bool bNew, value_type& item, const Q& val ); }; \endcode - + with arguments: with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - \p item - item of the set - - \p val - argument \p key passed into the \p ensure function + - \p val - argument \p key passed into the \p %update() function - The functor may change non-key fields of the \p item; however, \p func must guarantee + The functor can change non-key fields of the \p item; however, \p func must guarantee that during changing no any other modifications could be made on this item by concurrent threads. - Returns std::pair where \p first is true if operation is successfull, - \p second is true if new item has been added or \p false if the item with \p key - already is in the set. + Returns std::pair where \p first is \p true if operation is successfull, + i.e. the node has been inserted or updated, + \p second is \p true if new item has been added or \p false if the item with \p key + already exists. @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - std::pair ensure( const Q& val, Func func ) + std::pair update( const Q& val, Func func, bool bAllowInsert = true ) { scoped_node_ptr sp( cxx_leaf_node_allocator().New( val )); - std::pair bRes = base_class::ensure( *sp, - [&func, &val](bool bNew, leaf_node& node, leaf_node&){ func( bNew, node.m_Value, val ); }); + std::pair bRes = base_class::update( *sp, + [&func, &val](bool bNew, leaf_node& node, leaf_node&){ func( bNew, node.m_Value, val ); }, + bAllowInsert ); if ( bRes.first && bRes.second ) sp.release(); return bRes; } + //@cond + // Deprecated, use update() + template + std::pair ensure( const Q& val, Func func ) + { + return update( val, func, true ); + } + //@endcond /// Inserts data of type \p value_type created in-place from \p args /** @@ -476,34 +483,45 @@ namespace cds { namespace container { } //@endcond - /// Find the key \p key - /** @anchor cds_nonintrusive_EllenBinTreeSet_find_val - + /// Checks whether the set contains \p key + /** The function searches the item with key equal to \p key and returns \p true if it is found, and \p false otherwise. - - Note the hash functor specified for class \p Traits template parameter - should accept a parameter of type \p Q that may be not the same as \ref value_type. */ template + bool contains( Q const & key ) + { + return base_class::contains( key ); + } + //@cond + // Deprecated, use contains() + template bool find( Q const & key ) { - return base_class::find( key ); + return contains( key ); } + //@endcond - /// Finds the key \p key using \p pred predicate for searching + /// Checks whether the set contains \p key using \p pred predicate for searching /** - The function is an analog of \ref cds_nonintrusive_EllenBinTreeSet_find_val "find(Q const&)" - but \p pred is used for key comparing. + The function is similar to contains( key ) but \p pred is used for key comparing. \p Less functor has the interface like \p std::less. \p Less must imply the same element order as the comparator used for building the set. */ template - bool find_with( Q const& key, Less pred ) + bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::find_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >()); + return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >()); } + //@cond + // Deprecated, use contains() + template + bool find_with( Q const& key, Less pred ) + { + return contains( key, pred ); + } + //@endcond /// Finds \p key and returns the item found /** @anchor cds_nonintrusive_EllenBinTreeSet_get diff --git a/cds/intrusive/ellen_bintree_rcu.h b/cds/intrusive/ellen_bintree_rcu.h index 0515bb99..2f8f2e34 100644 --- a/cds/intrusive/ellen_bintree_rcu.h +++ b/cds/intrusive/ellen_bintree_rcu.h @@ -777,20 +777,21 @@ namespace cds { namespace intrusive { return true; } - /// Ensures that the \p val exists in the tree + /// Updates the node /** The operation performs inserting or changing data with lock-free manner. - If the item \p val is not found in the tree, then \p val is inserted into the tree. + If the item \p val is not found in the set, then \p val is inserted into the set + iff \p bAllowInsert is \p true. Otherwise, the functor \p func is called with item found. - The functor signature is: + The functor \p func signature is: \code void func( bool bNew, value_type& item, value_type& val ); \endcode with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - - \p item - item of the tree - - \p val - argument \p val passed into the \p ensure function + - \p item - item of the set + - \p val - argument \p val passed into the \p %update() function If new item has been inserted (i.e. \p bNew is \p true) then \p item and \p val arguments refer to the same thing. @@ -799,14 +800,15 @@ namespace cds { namespace intrusive { RCU \p synchronize method can be called. RCU should not be locked. - Returns std::pair where \p first is \p true if operation is successfull, + Returns std::pair where \p first is \p true if operation is successfull, + i.e. the node has been inserted or updated, \p second is \p true if new item has been added or \p false if the item with \p key - already is in the tree. + already exists. @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - std::pair ensure( value_type& val, Func func ) + std::pair update( value_type& val, Func func, bool bAllowInsert = true ) { check_deadlock_policy::check(); @@ -830,6 +832,9 @@ namespace cds { namespace intrusive { if ( res.updParent.bits() != update_desc::Clean ) help( res.updParent, updRetire ); else { + if ( !bAllowInsert ) + return std::make_pair( false, false ); + if ( !pNewInternal.get() ) pNewInternal.reset( alloc_internal_node() ); @@ -850,6 +855,14 @@ namespace cds { namespace intrusive { return std::make_pair( true, true ); } + //@cond + // Deprecated, use update() + template + std::pair ensure( value_type& val, Func func ) + { + return update( val, func, true ); + } + //@endcond /// Unlinks the item \p val from the tree /** @@ -1041,18 +1054,15 @@ namespace cds { namespace intrusive { return exempt_ptr( extract_with_( key, pred )); } - /// Finds the key \p key - /** @anchor cds_intrusive_EllenBinTree_rcu_find_val + /// Checks whether the set contains \p key + /** The function searches the item with key equal to \p key and returns \p true if it is found, and \p false otherwise. - Note the hash functor specified for class \p Traits template parameter - should accept a parameter of type \p Q that can be not the same as \p value_type. - The function applies RCU lock internally. */ template - bool find( Q const& key ) const + bool contains( Q const& key ) const { rcu_lock l; search_result res; @@ -1064,18 +1074,25 @@ namespace cds { namespace intrusive { m_Stat.onFindFailed(); return false; } + //@cond + // Deprecated, use contains() + template + bool find( Q const& key ) const + { + return contains( key ); + } + //@endcond - /// Finds the key \p key with comparing functor \p pred + /// Checks whether the set contains \p key using \p pred predicate for searching /** - The function is an analog of \ref cds_intrusive_EllenBinTree_rcu_find_val "find(Q const&)" - but \p pred is used for key compare. + The function is similar to contains( key ) but \p pred is used for key comparing. \p Less functor has the interface like \p std::less and should meet \ref cds_intrusive_EllenBinTree_rcu_less "Predicate requirements". - \p pred must imply the same element order as the comparator used for building the tree. + \p Less must imply the same element order as the comparator used for building the set. \p pred should accept arguments of type \p Q, \p key_type, \p value_type in any combination. */ template - bool find_with( Q const& key, Less pred ) const + bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); typedef ellen_bintree::details::compare< @@ -1094,6 +1111,14 @@ namespace cds { namespace intrusive { m_Stat.onFindFailed(); return false; } + //@cond + // Deprecated, use contains() + template + bool find_with( Q const& key, Less pred ) const + { + return contains( key, pred ); + } + //@endcond /// Finds the key \p key /** @anchor cds_intrusive_EllenBinTree_rcu_find_func diff --git a/cds/intrusive/impl/ellen_bintree.h b/cds/intrusive/impl/ellen_bintree.h index 58c6a6ac..5428090f 100644 --- a/cds/intrusive/impl/ellen_bintree.h +++ b/cds/intrusive/impl/ellen_bintree.h @@ -369,20 +369,21 @@ namespace cds { namespace intrusive { return true; } - /// Ensures that the \p val exists in the tree + /// Updates the node /** The operation performs inserting or changing data with lock-free manner. - If the item \p val is not found in the tree, then \p val is inserted into the tree. + If the item \p val is not found in the set, then \p val is inserted into the set + iff \p bAllowInsert is \p true. Otherwise, the functor \p func is called with item found. - The functor signature is: + The functor \p func signature is: \code void func( bool bNew, value_type& item, value_type& val ); \endcode with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - - \p item - an item of the tree - - \p val - the argument \p val passed to the \p ensure function + - \p item - item of the set + - \p val - argument \p val passed into the \p %update() function If new item has been inserted (i.e. \p bNew is \p true) then \p item and \p val arguments refer to the same thing. @@ -390,13 +391,14 @@ namespace cds { namespace intrusive { that during changing no any other modifications could be made on this item by concurrent threads. Returns std::pair where \p first is \p true if operation is successfull, + i.e. the node has been inserted or updated, \p second is \p true if new item has been added or \p false if the item with \p key - already is in the tree. + already exists. @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - std::pair ensure( value_type& val, Func func ) + std::pair update( value_type& val, Func func, bool bAllowInsert = true ) { typename gc::Guard guardInsert; guardInsert.assign( &val ); @@ -415,6 +417,8 @@ namespace cds { namespace intrusive { } if ( res.updGrandParent.bits() == update_desc::Clean && res.updParent.bits() == update_desc::Clean ) { + if ( !bAllowInsert ) + return std::make_pair( false, false ); if ( !pNewInternal.get() ) pNewInternal.reset( alloc_internal_node() ); @@ -434,6 +438,14 @@ namespace cds { namespace intrusive { m_Stat.onEnsureNew(); return std::make_pair( true, true ); } + //@cond + // Deprecated, us update() + template + std::pair ensure( value_type& val, Func func ) + { + return update( val, func, true ); + } + //@endcond /// Unlinks the item \p val from the tree /** @@ -622,16 +634,13 @@ namespace cds { namespace intrusive { return gp; } - /// Finds the key \p key - /** @anchor cds_intrusive_EllenBinTree_find_val + /// Checks whether the set contains \p key + /** The function searches the item with key equal to \p key and returns \p true if it is found, and \p false otherwise. - - Note the hash functor specified for class \p Traits template parameter - should accept a parameter of type \p Q that can be not the same as \p value_type. */ template - bool find( Q const& key ) const + bool contains( Q const& key ) const { search_result res; if ( search( res, key, node_compare() )) { @@ -642,18 +651,23 @@ namespace cds { namespace intrusive { m_Stat.onFindFailed(); return false; } + //@cond + // Deprecated, use contains() + template + bool find( Q const& key ) const + { + return contains( key ); + } + //@endcond - /// Finds the key \p key with comparing functor \p pred + /// Checks whether the set contains \p key using \p pred predicate for searching /** - The function is an analog of \ref cds_intrusive_EllenBinTree_find_val "find(Q const&)" - but \p pred is used for key compare. - \p Less functor has the interface like \p std::less and should meet \ref cds_intrusive_EllenBinTree_less - "Predicate requirements". - \p pred must imply the same element order as the comparator used for building the tree. - \p pred should accept arguments of type \p Q, \p key_type, \p value_type in any combination. + The function is similar to contains( key ) but \p pred is used for key comparing. + \p Less functor has the interface like \p std::less. + \p Less must imply the same element order as the comparator used for building the set. */ template - bool find_with( Q const& key, Less pred ) const + bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); typedef ellen_bintree::details::compare< @@ -671,6 +685,14 @@ namespace cds { namespace intrusive { m_Stat.onFindFailed(); return false; } + //@cond + // Deprecated, use contains() + template + bool find_with( Q const& key, Less pred ) const + { + return contains( key, pred ); + } + //@endcond /// Finds the key \p key /** @anchor cds_intrusive_EllenBinTree_find_func diff --git a/projects/Win/vc12/unit-map-delodd.vcxproj b/projects/Win/vc12/unit-map-delodd.vcxproj index 6888626c..8ae26e0e 100644 --- a/projects/Win/vc12/unit-map-delodd.vcxproj +++ b/projects/Win/vc12/unit-map-delodd.vcxproj @@ -51,7 +51,7 @@ true - true + false false diff --git a/tests/unit/map2/map_defs.h b/tests/unit/map2/map_defs.h index b7ecd466..9adc9845 100644 --- a/tests/unit/map2/map_defs.h +++ b/tests/unit/map2/map_defs.h @@ -409,16 +409,10 @@ #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED # define CDSUNIT_DECLARE_EllenBinTreeMap_RCU_signal \ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_shb)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_shb_stat)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_sht)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_sht_stat) - -# define CDSUNIT_DEFINE_EllenBinTreeMap_RCU_signal( IMPL, C ) \ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_shb)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_shb_stat)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_sht)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_sht_stat) + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_shb)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_shb_stat)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_sht)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_sht_stat) # define CDSUNIT_TEST_EllenBinTreeMap_RCU_signal \ CPPUNIT_TEST(EllenBinTreeMap_rcu_shb)\ @@ -427,42 +421,25 @@ CPPUNIT_TEST(EllenBinTreeMap_rcu_sht_stat) #else # define CDSUNIT_DECLARE_EllenBinTreeMap_RCU_signal -# define CDSUNIT_DEFINE_EllenBinTreeMap_RCU_signal( IMPL, C ) # define CDSUNIT_TEST_EllenBinTreeMap_RCU_signal #endif #define CDSUNIT_DECLARE_EllenBinTreeMap \ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_hp)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_hp_yield)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_hp_stat)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_dhp)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_dhp_yield)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_dhp_stat)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpi)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpi_stat)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpb)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpb_yield)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpb_stat)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpt)\ - CDSUNIT_DECLARE_TEST(EllenBinTreeMap_rcu_gpt_stat)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_hp)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_hp_yield)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_hp_stat)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_dhp)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_dhp_yield)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_dhp_stat)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpi)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpi_stat)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpb)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpb_yield)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpb_stat)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpt)\ + TEST_CASE(tag_EllenBinTreeMap, EllenBinTreeMap_rcu_gpt_stat)\ CDSUNIT_DECLARE_EllenBinTreeMap_RCU_signal -#define CDSUNIT_DEFINE_EllenBinTreeMap( IMPL, C ) \ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_hp)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_hp_yield)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_hp_stat)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_dhp)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_dhp_yield)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_dhp_stat)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpi)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpi_stat)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpb)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpb_yield)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpb_stat)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpt)\ - TEST_MAP_NOLF_EXTRACT(IMPL, C, EllenBinTreeMap_rcu_gpt_stat)\ - CDSUNIT_DEFINE_EllenBinTreeMap_RCU_signal( IMPL, C ) - #define CDSUNIT_TEST_EllenBinTreeMap \ CPPUNIT_TEST(EllenBinTreeMap_hp)\ CPPUNIT_TEST(EllenBinTreeMap_hp_yield)\ diff --git a/tests/unit/map2/map_delodd.h b/tests/unit/map2/map_delodd.h index 443b54e1..fe45c678 100644 --- a/tests/unit/map2/map_delodd.h +++ b/tests/unit/map2/map_delodd.h @@ -692,6 +692,7 @@ namespace map2 { CDSUNIT_DECLARE_MichaelMap CDSUNIT_DECLARE_SplitList CDSUNIT_DECLARE_SkipListMap + CDSUNIT_DECLARE_EllenBinTreeMap // This test is not suitable for MultiLevelHashMap //CDSUNIT_DECLARE_MultiLevelHashMap @@ -700,6 +701,7 @@ namespace map2 { CDSUNIT_TEST_MichaelMap CDSUNIT_TEST_SplitList CDSUNIT_TEST_SkipListMap + CDSUNIT_TEST_EllenBinTreeMap //CDSUNIT_TEST_MultiLevelHashMap // the test is not suitable CPPUNIT_TEST_SUITE_END(); @@ -707,7 +709,6 @@ namespace map2 { ////CDSUNIT_DECLARE_StripedMap ////CDSUNIT_DECLARE_RefinableMap //CDSUNIT_DECLARE_CuckooMap - //CDSUNIT_DECLARE_EllenBinTreeMap //CDSUNIT_DECLARE_BronsonAVLTreeMap //CDSUNIT_DECLARE_MultiLevelHashMap ////CDSUNIT_DECLARE_StdMap diff --git a/tests/unit/map2/map_delodd_ellentree.cpp b/tests/unit/map2/map_delodd_ellentree.cpp index fdeab825..c6139e51 100644 --- a/tests/unit/map2/map_delodd_ellentree.cpp +++ b/tests/unit/map2/map_delodd_ellentree.cpp @@ -3,10 +3,10 @@ #include "map2/map_delodd.h" #include "map2/map_type_ellen_bintree.h" -namespace map2 { - CDSUNIT_DEFINE_EllenBinTreeMap( cc::ellen_bintree::implementation_tag, Map_DelOdd) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Map_DelOdd::X() { run_test::X>(); } +#include "map2/map_defs.h" - CPPUNIT_TEST_SUITE_PART( Map_DelOdd, run_EllenBinTreeMap ) - CDSUNIT_TEST_EllenBinTreeMap - CPPUNIT_TEST_SUITE_END_PART() +namespace map2 { + CDSUNIT_DECLARE_EllenBinTreeMap } // namespace map2 diff --git a/tests/unit/map2/map_type_ellen_bintree.h b/tests/unit/map2/map_type_ellen_bintree.h index 6b382b16..bc29546e 100644 --- a/tests/unit/map2/map_type_ellen_bintree.h +++ b/tests/unit/map2/map_type_ellen_bintree.h @@ -14,8 +14,25 @@ namespace map2 { + template + class EllenBinTreeMap : public cc::EllenBinTreeMap< GC, Key, T, Traits > + { + typedef cc::EllenBinTreeMap< GC, Key, T, Traits > base_class; + public: + template + EllenBinTreeMap( Config const& /*cfg*/) + : base_class() + {} + + // for testing + static CDS_CONSTEXPR bool const c_bExtractSupported = true; + static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; + }; + + struct tag_EllenBinTreeMap; + template - struct map_type< cc::ellen_bintree::implementation_tag, Key, Value >: public map_type_base< Key, Value > + struct map_type< tag_EllenBinTreeMap, Key, Value >: public map_type_base< Key, Value > { typedef map_type_base< Key, Value > base_class; typedef typename base_class::compare compare; @@ -70,38 +87,38 @@ namespace map2 { struct traits_EllenBinTreeMap_hp : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::hp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_hp >EllenBinTreeMap_hp; + typedef EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_hp >EllenBinTreeMap_hp; struct traits_EllenBinTreeMap_dhp : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::dhp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< cds::gc::DHP, Key, Value, traits_EllenBinTreeMap_dhp >EllenBinTreeMap_dhp; + typedef EllenBinTreeMap< cds::gc::DHP, Key, Value, traits_EllenBinTreeMap_dhp >EllenBinTreeMap_dhp; struct traits_EllenBinTreeMap_gpi : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpi::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpi, Key, Value, traits_EllenBinTreeMap_gpi >EllenBinTreeMap_rcu_gpi; + typedef EllenBinTreeMap< rcu_gpi, Key, Value, traits_EllenBinTreeMap_gpi >EllenBinTreeMap_rcu_gpi; struct traits_EllenBinTreeMap_gpb : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpb, Key, Value, traits_EllenBinTreeMap_gpb >EllenBinTreeMap_rcu_gpb; + typedef EllenBinTreeMap< rcu_gpb, Key, Value, traits_EllenBinTreeMap_gpb >EllenBinTreeMap_rcu_gpb; struct traits_EllenBinTreeMap_gpt : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpt::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpt, Key, Value, traits_EllenBinTreeMap_gpt >EllenBinTreeMap_rcu_gpt; + typedef EllenBinTreeMap< rcu_gpt, Key, Value, traits_EllenBinTreeMap_gpt >EllenBinTreeMap_rcu_gpt; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED struct traits_EllenBinTreeMap_shb : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::shb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_shb, Key, Value, traits_EllenBinTreeMap_shb >EllenBinTreeMap_rcu_shb; + typedef EllenBinTreeMap< rcu_shb, Key, Value, traits_EllenBinTreeMap_shb >EllenBinTreeMap_rcu_shb; struct traits_EllenBinTreeMap_sht : traits_EllenBinTreeMap { typedef cds::memory::pool_allocator< typename ellen_bintree_props::sht::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_sht, Key, Value, traits_EllenBinTreeMap_sht >EllenBinTreeMap_rcu_sht; + typedef EllenBinTreeMap< rcu_sht, Key, Value, traits_EllenBinTreeMap_sht >EllenBinTreeMap_rcu_sht; #endif struct traits_EllenBinTreeMap_yield : public traits_EllenBinTreeMap @@ -111,17 +128,17 @@ namespace map2 { struct traits_EllenBinTreeMap_hp_yield : traits_EllenBinTreeMap_yield { typedef cds::memory::pool_allocator< typename ellen_bintree_props::hp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_hp_yield >EllenBinTreeMap_hp_yield; + typedef EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_hp_yield >EllenBinTreeMap_hp_yield; struct traits_EllenBinTreeMap_dhp_yield : traits_EllenBinTreeMap_yield { typedef cds::memory::pool_allocator< typename ellen_bintree_props::dhp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< cds::gc::DHP, Key, Value, traits_EllenBinTreeMap_dhp_yield >EllenBinTreeMap_dhp_yield; + typedef EllenBinTreeMap< cds::gc::DHP, Key, Value, traits_EllenBinTreeMap_dhp_yield >EllenBinTreeMap_dhp_yield; struct traits_EllenBinTreeMap_gpb_yield : traits_EllenBinTreeMap_yield { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpb, Key, Value, traits_EllenBinTreeMap_gpb_yield >EllenBinTreeMap_rcu_gpb_yield; + typedef EllenBinTreeMap< rcu_gpb, Key, Value, traits_EllenBinTreeMap_gpb_yield >EllenBinTreeMap_rcu_gpb_yield; struct traits_EllenBinTreeMap_stat: public cc::ellen_bintree::make_set_traits< @@ -139,54 +156,54 @@ namespace map2 { { typedef cds::memory::pool_allocator< typename ellen_bintree_props::hp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_stat_hp > EllenBinTreeMap_hp_stat; + typedef EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_stat_hp > EllenBinTreeMap_hp_stat; struct traits_EllenBinTreeMap_stat_dhp : public traits_EllenBinTreeMap_stat { typedef cds::memory::pool_allocator< typename ellen_bintree_props::dhp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_stat_dhp > EllenBinTreeMap_dhp_stat; + typedef EllenBinTreeMap< cds::gc::HP, Key, Value, traits_EllenBinTreeMap_stat_dhp > EllenBinTreeMap_dhp_stat; struct traits_EllenBinTreeMap_stat_gpi : public traits_EllenBinTreeMap_stat { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpi::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpi, Key, Value, traits_EllenBinTreeMap_stat_gpi > EllenBinTreeMap_rcu_gpi_stat; + typedef EllenBinTreeMap< rcu_gpi, Key, Value, traits_EllenBinTreeMap_stat_gpi > EllenBinTreeMap_rcu_gpi_stat; struct traits_EllenBinTreeMap_stat_gpb : public traits_EllenBinTreeMap_stat { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpb, Key, Value, traits_EllenBinTreeMap_stat_gpb > EllenBinTreeMap_rcu_gpb_stat; + typedef EllenBinTreeMap< rcu_gpb, Key, Value, traits_EllenBinTreeMap_stat_gpb > EllenBinTreeMap_rcu_gpb_stat; struct traits_EllenBinTreeMap_stat_gpt : public traits_EllenBinTreeMap_stat { typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpt::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_gpt, Key, Value, traits_EllenBinTreeMap_stat_gpt > EllenBinTreeMap_rcu_gpt_stat; + typedef EllenBinTreeMap< rcu_gpt, Key, Value, traits_EllenBinTreeMap_stat_gpt > EllenBinTreeMap_rcu_gpt_stat; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED struct traits_EllenBinTreeMap_stat_shb : public traits_EllenBinTreeMap_stat { typedef cds::memory::pool_allocator< typename ellen_bintree_props::shb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_shb, Key, Value, traits_EllenBinTreeMap_stat_shb > EllenBinTreeMap_rcu_shb_stat; + typedef EllenBinTreeMap< rcu_shb, Key, Value, traits_EllenBinTreeMap_stat_shb > EllenBinTreeMap_rcu_shb_stat; struct traits_EllenBinTreeMap_stat_sht : public traits_EllenBinTreeMap_stat { typedef cds::memory::pool_allocator< typename ellen_bintree_props::sht::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; }; - typedef cc::EllenBinTreeMap< rcu_sht, Key, Value, traits_EllenBinTreeMap_stat_sht > EllenBinTreeMap_rcu_sht_stat; + typedef EllenBinTreeMap< rcu_sht, Key, Value, traits_EllenBinTreeMap_stat_sht > EllenBinTreeMap_rcu_sht_stat; #endif }; template - static inline void print_stat( cc::EllenBinTreeMap const& s ) + static inline void print_stat( EllenBinTreeMap const& s ) { CPPUNIT_MSG( s.statistics() ); } template - static inline void additional_cleanup( cc::EllenBinTreeMap& /*s*/ ) + static inline void additional_cleanup( EllenBinTreeMap& /*s*/ ) { ellen_bintree_pool::internal_node_counter::reset(); } @@ -216,14 +233,14 @@ namespace map2 { } } // namespace ellen_bintree_check template - static inline void additional_check( cc::EllenBinTreeMap& s ) + static inline void additional_check( EllenBinTreeMap& s ) { GC::force_dispose(); ellen_bintree_check::check_stat( s.statistics() ); } template - static inline void check_before_cleanup( cc::EllenBinTreeMap& m ) + static inline void check_before_cleanup( EllenBinTreeMap& m ) { CPPUNIT_MSG( " Check internal consistency (single-threaded)..." ); CPPUNIT_CHECK_CURRENT( m.check_consistency() ); diff --git a/tests/unit/map2/map_type_skip_list.h b/tests/unit/map2/map_type_skip_list.h index 8f95050e..2a4cd57c 100644 --- a/tests/unit/map2/map_type_skip_list.h +++ b/tests/unit/map2/map_type_skip_list.h @@ -26,7 +26,7 @@ namespace map2 { // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = true; - static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true; + static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; }; struct tag_SkipListMap; -- 2.34.1