/*
This file is a part of libcds - Concurrent Data Structures library
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
: base_class()
{}
+ std::pair<Key, bool> extract_min_key()
+ {
+ auto xp = base_class::extract_min();
+ if ( xp )
+ return std::make_pair( xp->first, true );
+ return std::make_pair( Key(), false );
+ }
+
+ std::pair<Key, bool> extract_max_key()
+ {
+ auto xp = base_class::extract_max();
+ if ( xp )
+ return std::make_pair( xp->first, true );
+ return std::make_pair( Key(), false );
+ }
+
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
typedef cc::ellen_bintree::internal_node< Key, leaf_node > internal_node;
typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc;
};
- struct sht {
- typedef cc::ellen_bintree::map_node<rcu_sht, Key, Value> leaf_node;
- typedef cc::ellen_bintree::internal_node< Key, leaf_node > internal_node;
- typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc;
- };
#endif
};
struct traits_EllenBinTreeMap: public cc::ellen_bintree::make_set_traits<
co::less< less >
,co::node_allocator< ellen_bintree_pool::internal_node_allocator< int > >
- ,co::item_counter< cds::atomicity::item_counter >
+ ,co::item_counter< cds::atomicity::cache_friendly_item_counter >
>::type
{};
struct traits_EllenBinTreeMap_hp : 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 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 EllenBinTreeMap< rcu_sht, Key, Value, traits_EllenBinTreeMap_sht > EllenBinTreeMap_rcu_sht;
#endif
struct traits_EllenBinTreeMap_yield : public traits_EllenBinTreeMap
>
,co::node_allocator< ellen_bintree_pool::internal_node_allocator< int > >
,co::stat< cc::ellen_bintree::stat<> >
- ,co::item_counter< cds::atomicity::item_counter >
+ ,co::item_counter< cds::atomicity::cache_friendly_item_counter >
>::type
{};
typedef cds::memory::pool_allocator< typename ellen_bintree_props::shb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator;
};
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 EllenBinTreeMap< rcu_sht, Key, Value, traits_EllenBinTreeMap_stat_sht > EllenBinTreeMap_rcu_sht_stat;
#endif
};
#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
# define CDSSTRESS_EllenBinTreeMap_SHRCU( fixture, test_case, key_type, value_type ) \
CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_shb, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_sht, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_shb_stat, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_sht_stat, key_type, value_type )
+
#else
# define CDSSTRESS_EllenBinTreeMap_SHRCU( fixture, test_case, key_type, value_type )
#endif
-#define CDSSTRESS_EllenBinTreeMap( fixture, test_case, key_type, value_type ) \
+#if defined(CDS_STRESS_TEST_LEVEL) && CDS_STRESS_TEST_LEVEL > 0
+# define CDSSTRESS_EllenBinTreeMap_HP_1( fixture, test_case, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_hp_yield, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_dhp_yield, key_type, value_type ) \
+
+
+# define CDSSTRESS_EllenBinTreeMap_RCU_1( fixture, test_case, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpi, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpb_yield, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_SHRCU( fixture, test_case, key_type, value_type ) \
+
+#else
+# define CDSSTRESS_EllenBinTreeMap_HP_1( fixture, test_case, key_type, value_type )
+# define CDSSTRESS_EllenBinTreeMap_RCU_1( fixture, test_case, key_type, value_type )
+#endif
+
+#define CDSSTRESS_EllenBinTreeMap_HP( fixture, test_case, key_type, value_type ) \
CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_hp, key_type, value_type ) \
CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_dhp, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpi, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_HP_1( fixture, test_case, key_type, value_type ) \
+
+#define CDSSTRESS_EllenBinTreeMap_RCU( fixture, test_case, key_type, value_type ) \
CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpb, key_type, value_type ) \
CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpt, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_hp_yield, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_dhp_yield, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpb_yield, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_hp_stat, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_dhp_stat, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpi_stat, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpb_stat, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_case( fixture, test_case, EllenBinTreeMap_rcu_gpt_stat, key_type, value_type ) \
- CDSSTRESS_EllenBinTreeMap_SHRCU( fixture, test_case, key_type, value_type )
+ CDSSTRESS_EllenBinTreeMap_RCU_1( fixture, test_case, key_type, value_type ) \
+
+#define CDSSTRESS_EllenBinTreeMap( fixture, test_case, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_HP( fixture, test_case, key_type, value_type ) \
+ CDSSTRESS_EllenBinTreeMap_RCU( fixture, test_case, key_type, value_type ) \
#endif // ifndef CDSUNIT_MAP_TYPE_ELLEN_BINTREE_H