Fixed SplitList destroying sequence
authorkhizmax <libcds.dev@gmail.com>
Wed, 14 Sep 2016 20:30:49 +0000 (23:30 +0300)
committerkhizmax <libcds.dev@gmail.com>
Wed, 14 Sep 2016 20:30:49 +0000 (23:30 +0300)
cds/intrusive/impl/michael_list.h
cds/intrusive/michael_list_nogc.h
cds/intrusive/michael_list_rcu.h
cds/intrusive/split_list.h
cds/intrusive/split_list_nogc.h
cds/intrusive/split_list_rcu.h
cds/opt/options.h

index d279a21ba561d63992f877764c30d88ccd6eeffc..759b13cf8500d329e41eb1fb029fff66fa90e565 100644 (file)
@@ -5,7 +5,7 @@
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
 
     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:
 
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
index 2fa260cf5a77e166f9f6877e5720e548833a6f8c..90455a28b19fd58b1f1206074d85756bb5e8d515 100644 (file)
@@ -5,7 +5,7 @@
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
 
     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:
 
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
index 1b215c1d52ac719e91547d87a3d539b7ef032052..7fbc68e6a55b094ef89f97f65682f6ab3ea723d8 100644 (file)
@@ -5,7 +5,7 @@
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
 
     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:
 
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
index 7391a10138f7d366838ab8633c8075129f17697f..00258117ca648eb1c99f43e32234327933e44cf4 100644 (file)
@@ -403,6 +403,15 @@ namespace cds { namespace intrusive {
             init();
         }
 
             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
         /**
     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.
         /// 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.
         */
 
             For each item the \p disposer is called after unlinking.
         */
@@ -1213,10 +1222,12 @@ namespace cds { namespace intrusive {
 
     protected:
         //@cond
 
     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
 
         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<size_t> m_nBucketCountLog2; ///< log2( current bucket count )
         padded_ordered_list     m_List;             ///< Ordered list containing split-list items
 
         atomics::atomic<size_t> m_nBucketCountLog2; ///< log2( current bucket count )
index 15446090b7637302b827a399574f182575759cd2..f4f146f915e0b6b08af91428d6c697d00906b7b9 100644 (file)
@@ -205,6 +205,11 @@ namespace cds { namespace intrusive {
             init();
         }
 
             init();
         }
 
+        /// Destroys split-list
+        ~SplitListSet()
+        {
+            m_List.clear();
+        }
     public:
         /// Inserts new node
         /**
     public:
         /// Inserts new node
         /**
index 8ea2078d97e53085d4f3061f758f623ee66f98f9..9791aa21b1e66bcdca70c9fdc2865d70ed1b3752 100644 (file)
@@ -298,6 +298,13 @@ namespace cds { namespace intrusive {
             init();
         }
 
             init();
         }
 
+        /// Destroys split-list
+        ~SplitListSet()
+        {
+            m_List.clear();
+            gc::force_dispose();
+        }
+
     public:
         /// Inserts new node
         /**
     public:
         /// Inserts new node
         /**
index 53e124c5d3b3a397b17ea73ebceafb1f1ee96862..7a124aa26921c38197c0ed634fa508b12c913828 100644 (file)
@@ -372,7 +372,7 @@ namespace opt {
 
         /// Apply padding only for tiny data when data size is less than required padding
         /**
 
         /// 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:
             Otherwise no padding will be applyed.
 
             This flag is applyed for padding value: