From: khizmax Date: Sat, 5 Sep 2015 13:16:30 +0000 (+0300) Subject: Refactored Map_insdel_int MT-test X-Git-Tag: v2.1.0~138 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=bcdfd59db560213caf15537dd8ea5ce5eb222232;p=libcds.git Refactored Map_insdel_int MT-test Removed cds/opt/make_option_var.h, its content is moved to cds/opt/options.h --- diff --git a/cds/container/striped_map.h b/cds/container/striped_map.h index 17864e1b..a40e5d31 100644 --- a/cds/container/striped_map.h +++ b/cds/container/striped_map.h @@ -68,19 +68,19 @@ namespace cds { namespace container { among \p Options template arguments. The \p Options are: - - \p opt::mutex_policy - concurrent access policy. - Available policies: \p intrusive::striped_set::striping, \p intrusive::striped_set::refinable. - Default is %striped_set::striping. - - \p opt::hash - hash functor. Default option value see opt::v::hash_selector + - \p cds::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 opt::v::hash_selector which selects default hash functor for your compiler. - - \p opt::compare - key comparison functor. No default functor is provided. + - \p cds::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. - - \p opt::item_counter - item counter type. Default is \p atomicity::item_counter since some operation on the counter is performed + - \p cds::opt::less - specifies binary predicate used for key comparison. Default is \p std::less. + - \p cds::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 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 cds::opt::allocator - the allocator type using for memory allocation of bucket table and lock array. Default is \ref CDS_DEFAULT_ALLOCATOR. + - \p cds::opt::resizing_policy - the resizing policy that is a functor that decides when to resize the hash map. Default option value depends on bucket container type: for sequential containers like \p std::list, \p std::vector the resizing policy is striped_set::load_factor_resizing<4> ; for other type of containers like \p std::map, \p std::unordered_map the resizing policy is \p striped_set::no_resizing. @@ -90,7 +90,7 @@ namespace cds { namespace container { significantly improve performance. For other, non-sequential types of \p Container (like a \p std::map) the resizing policy is not so important. - - \p opt::copy_policy - the copy policy which is used to copy items from the old map to the new one when resizing. + - \p cds::opt::copy_policy - the copy policy which is used to copy items from the old map to the new one when resizing. The policy can be optionally used in adapted bucket container for performance reasons of resizing. The detail of copy algorithm depends on type of bucket container and explains below. @@ -491,9 +491,6 @@ template typedef typename base_class::allocator_type allocator_type ; ///< allocator type specified in options. typedef typename base_class::mutex_policy mutex_policy ; ///< Mutex policy - //@cond - typedef cds::container::striped_set::implementation_tag implementation_tag; - //@endcond protected: //@cond typedef typename base_class::scoped_cell_lock scoped_cell_lock; diff --git a/cds/container/striped_set.h b/cds/container/striped_set.h index af53836a..c1828458 100644 --- a/cds/container/striped_set.h +++ b/cds/container/striped_set.h @@ -482,10 +482,6 @@ namespace cds { namespace container { typedef typename base_class::allocator_type allocator_type ; ///< allocator type specified in options. typedef typename base_class::mutex_policy mutex_policy ; ///< Mutex policy - //@cond - typedef cds::container::striped_set::implementation_tag implementation_tag; - //@endcond - protected: //@cond typedef typename base_class::scoped_cell_lock scoped_cell_lock; diff --git a/cds/container/striped_set/adapter.h b/cds/container/striped_set/adapter.h index 72b78908..b6deb8cc 100644 --- a/cds/container/striped_set/adapter.h +++ b/cds/container/striped_set/adapter.h @@ -9,7 +9,6 @@ namespace cds { namespace container { /// Striped hash set related definitions namespace striped_set { - using cds::intrusive::striped_set::implementation_tag; //@cond struct copy_item ; // copy_item_policy tag @@ -178,15 +177,34 @@ namespace cds { namespace container { //@cond using cds::intrusive::striped_set::adapted_sequential_container; using cds::intrusive::striped_set::adapted_container; + //@endcond - using cds::intrusive::striped_set::load_factor_resizing; - using cds::intrusive::striped_set::rational_load_factor_resizing; - using cds::intrusive::striped_set::single_bucket_size_threshold; - using cds::intrusive::striped_set::no_resizing; + ///@copydoc cds::intrusive::striped_set::load_factor_resizing + template + using load_factor_resizing = cds::intrusive::striped_set::load_factor_resizing; - using cds::intrusive::striped_set::striping; - using cds::intrusive::striped_set::refinable; - //@endcond + ///@copydoc cds::intrusive::striped_set::rational_load_factor_resizing + template + using rational_load_factor_resizing = cds::intrusive::striped_set::rational_load_factor_resizing; + + ///@copydoc cds::intrusive::striped_set::single_bucket_size_threshold + template + using single_bucket_size_threshold = cds::intrusive::striped_set::single_bucket_size_threshold; + + ///@copydoc cds::intrusive::striped_set::no_resizing + typedef cds::intrusive::striped_set::no_resizing no_resizing; + + ///@copydoc cds::intrusive::striped_set::striping + template + using striping = cds::intrusive::striped_set::striping; + + ///@copydoc cds::intrusive::striped_set::refinable + template < + class RecursiveLock = std::recursive_mutex, + typename BackOff = cds::backoff::yield, + class Alloc = CDS_DEFAULT_ALLOCATOR + > + using refinable = cds::intrusive::striped_set::refinable; //@cond namespace details { diff --git a/cds/opt/make_options_var.h b/cds/opt/make_options_var.h deleted file mode 100644 index cbcdd96d..00000000 --- a/cds/opt/make_options_var.h +++ /dev/null @@ -1,301 +0,0 @@ -//$$CDS-header$$ - -#ifndef CDSLIB_OPT_MAKE_OPTIONS_VAR_H -#define CDSLIB_OPT_MAKE_OPTIONS_VAR_H - -#ifndef CDSLIB_OPT_OPTIONS_H -# error must be included instead of -#endif - -namespace cds { namespace opt { - - //@cond - namespace details { - template - struct do_pack - { - // Use "pack" member template to pack options - typedef typename Option::template pack type; - }; - - template class typelist; - - template struct typelist_head; - template - struct typelist_head< typelist > { - typedef Head type; - }; - template - struct typelist_head< typelist > { - typedef Head type; - }; - - template struct typelist_tail; - template - struct typelist_tail< typelist > { - typedef typelist type; - }; - template - struct typelist_tail< typelist > { - typedef typelist<> type; - }; - - template - struct make_options_impl { - typedef typename make_options_impl< - typename do_pack< - OptionList, - typename typelist_head< Typelist >::type - >::type, - typename typelist_tail::type - >::type type; - }; - - template - struct make_options_impl > { - typedef OptionList type; - }; - } // namespace details - //@endcond - - /// make_options metafunction - /** @headerfile cds/opt/options.h - - The metafunction converts option list \p Options to traits structure. - The result of metafunction is \p type. - - Template parameter \p OptionList is default option set (default traits). - \p Options is option list. - */ - template - struct make_options { -#ifdef CDS_DOXYGEN_INVOKED - typedef implementation_defined type ; ///< Result of the metafunction -#else - typedef typename details::make_options_impl< OptionList, details::typelist >::type type; -#endif - }; - - - // ***************************************************************** - // find_type_traits metafunction - // ***************************************************************** - - //@cond - namespace details { - template - struct find_type_traits_option; - - template <> - struct find_type_traits_option<> { - typedef cds::opt::none type; - }; - - template - struct find_type_traits_option< Any > { - typedef cds::opt::none type; - }; - - template - struct find_type_traits_option< cds::opt::type_traits< Any > > { - typedef Any type; - }; - - template - struct find_type_traits_option< cds::opt::type_traits< Any >, Options... > { - typedef Any type; - }; - - template - struct find_type_traits_option< Any, Options... > { - typedef typename find_type_traits_option< Options... >::type type; - }; - } // namespace details - //@endcond - - /// Metafunction to find opt::type_traits option in \p Options list - /** @headerfile cds/opt/options.h - - If \p Options contains opt::type_traits option then it is the metafunction result. - Otherwise the result is \p DefaultOptons. - */ - template - struct find_type_traits { - typedef typename select_default< typename details::find_type_traits_option::type, DefaultOptions>::type type ; ///< Metafunction result - }; - - - // ***************************************************************** - // find_option metafunction - // ***************************************************************** - - //@cond - namespace details { - template - struct find_option; - - struct compare_ok; - struct compare_fail; - - template - struct compare_option - { - typedef compare_fail type; - }; - - template