From 4205cdb8291f12529f17b33aae51f46818d85356 Mon Sep 17 00:00:00 2001 From: khizmax Date: Wed, 14 Sep 2016 23:30:49 +0300 Subject: [PATCH] Fixed SplitList destroying sequence --- cds/intrusive/impl/michael_list.h | 2 +- cds/intrusive/michael_list_nogc.h | 2 +- cds/intrusive/michael_list_rcu.h | 2 +- cds/intrusive/split_list.h | 17 ++++++++++++++--- cds/intrusive/split_list_nogc.h | 5 +++++ cds/intrusive/split_list_rcu.h | 7 +++++++ cds/opt/options.h | 2 +- 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/cds/intrusive/impl/michael_list.h b/cds/intrusive/impl/michael_list.h index d279a21b..759b13cf 100644 --- a/cds/intrusive/impl/michael_list.h +++ b/cds/intrusive/impl/michael_list.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/cds/intrusive/michael_list_nogc.h b/cds/intrusive/michael_list_nogc.h index 2fa260cf..90455a28 100644 --- a/cds/intrusive/michael_list_nogc.h +++ b/cds/intrusive/michael_list_nogc.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/cds/intrusive/michael_list_rcu.h b/cds/intrusive/michael_list_rcu.h index 1b215c1d..7fbc68e6 100644 --- a/cds/intrusive/michael_list_rcu.h +++ b/cds/intrusive/michael_list_rcu.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/cds/intrusive/split_list.h b/cds/intrusive/split_list.h index 7391a101..00258117 100644 --- a/cds/intrusive/split_list.h +++ b/cds/intrusive/split_list.h @@ -403,6 +403,15 @@ namespace cds { namespace intrusive { init(); } + /// Destroys split-list set + ~SplitListSet() + { + // list contains aux node that cannot be retired + // all aux nodes will be destroyed by bucket table dtor + m_List.clear(); + gc::force_dispose(); + } + public: /// Inserts new node /** @@ -837,7 +846,7 @@ namespace cds { namespace intrusive { /// Clears the set (non-atomic) /** The function unlink all items from the set. - The function is not atomic. Therefore, \p clear may be used only for debugging purposes. + The function is not atomic. After call the split-list can be non-empty. For each item the \p disposer is called after unlinking. */ @@ -1213,10 +1222,12 @@ namespace cds { namespace intrusive { protected: //@cond - typedef typename cds::details::type_padding< bucket_table, traits::padding >::type padded_bucket_table; + static unsigned const c_padding = cds::opt::actual_padding< traits::padding >::value; + + typedef typename cds::details::type_padding< bucket_table, c_padding >::type padded_bucket_table; padded_bucket_table m_Buckets; ///< bucket table - typedef typename cds::details::type_padding< ordered_list_wrapper, traits::padding>::type padded_ordered_list; + typedef typename cds::details::type_padding< ordered_list_wrapper, c_padding >::type padded_ordered_list; padded_ordered_list m_List; ///< Ordered list containing split-list items atomics::atomic m_nBucketCountLog2; ///< log2( current bucket count ) diff --git a/cds/intrusive/split_list_nogc.h b/cds/intrusive/split_list_nogc.h index 15446090..f4f146f9 100644 --- a/cds/intrusive/split_list_nogc.h +++ b/cds/intrusive/split_list_nogc.h @@ -205,6 +205,11 @@ namespace cds { namespace intrusive { init(); } + /// Destroys split-list + ~SplitListSet() + { + m_List.clear(); + } public: /// Inserts new node /** diff --git a/cds/intrusive/split_list_rcu.h b/cds/intrusive/split_list_rcu.h index 8ea2078d..9791aa21 100644 --- a/cds/intrusive/split_list_rcu.h +++ b/cds/intrusive/split_list_rcu.h @@ -298,6 +298,13 @@ namespace cds { namespace intrusive { init(); } + /// Destroys split-list + ~SplitListSet() + { + m_List.clear(); + gc::force_dispose(); + } + public: /// Inserts new node /** diff --git a/cds/opt/options.h b/cds/opt/options.h index 53e124c5..7a124aa2 100644 --- a/cds/opt/options.h +++ b/cds/opt/options.h @@ -372,7 +372,7 @@ namespace opt { /// Apply padding only for tiny data when data size is less than required padding /** - The flag means that if your data size is less than the casheline size, the padding is applyed. + The flag means that if your data size is less than the cacheline size, the padding is applyed. Otherwise no padding will be applyed. This flag is applyed for padding value: -- 2.34.1