Adds a few single-threaded test cases for queue, stack, and set
[libcds.git] / cds / intrusive / free_list.h
index c309d7d11e00e8dca1eb16c0b64748fedcc8274b..b3a490bbf65d57471069df8968b23479c9910cb0 100644 (file)
@@ -1,7 +1,7 @@
 /*
     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/
@@ -38,7 +38,7 @@ namespace cds { namespace intrusive {
     /// Lock-free free list
     /** @ingroup cds_intrusive_freelist
 
-        Free list is a helper class intended for reusing objects instead of freeing them completely; 
+        Free list is a helper class intended for reusing objects instead of freeing them completely;
         this avoids the overhead of \p malloc(), and also avoids its worst-case behavior of taking an operating system lock.
         So, the free list can be considered as a specialized allocator for objects of some type.
 
@@ -97,8 +97,9 @@ namespace cds { namespace intrusive {
 
             node()
                 : m_freeListRefs( 0 )
-                , m_freeListNext( nullptr )
-            {}
+            {
+                m_freeListNext.store( nullptr, atomics::memory_order_release );
+            }
             //@endcond
         };
 
@@ -115,7 +116,7 @@ namespace cds { namespace intrusive {
         */
         ~FreeList()
         {
-            assert( empty() );
+            assert( empty());
         }
 
         /// Puts \p pNode to the free list