reformatting
[libcds.git] / cds / intrusive / free_list.h
index 113610a92d2dc87f2b5118a41a3d4db1290ae193..b3a490bbf65d57471069df8968b23479c9910cb0 100644 (file)
@@ -1,11 +1,11 @@
 /*
     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/
-    
+
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
 namespace cds { namespace intrusive {
 
     /// Lock-free free list
-    /** @ingroup cds_intrusive_helper
+    /** @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.
 
         The algorithm is taken from <a href="http://moodycamel.com/blog/2014/solving-the-aba-problem-for-lock-free-free-lists">this article</a>.
         The algo does not require any SMR like Hazard Pointer to prevent ABA problem.
 
-        There is \ref TaggedFreeList "tagged pointers" variant of free list for processors which support double-width CAS.
+        There is \ref TaggedFreeList "tagged pointers" variant of free list for processors with double-width CAS support.
 
         \b How to use
         \code
@@ -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