TreiberStack: small doc improvements
[libcds.git] / cds / intrusive / lazy_list_nogc.h
index da544691462face35ae41cad01d8c2185d927d7e..e2b6f96ed5e147af0246a3ee7d89ac533496a2e6 100644 (file)
@@ -3,7 +3,8 @@
 #ifndef __CDS_INTRUSIVE_LAZY_LIST_NOGC_H
 #define __CDS_INTRUSIVE_LAZY_LIST_NOGC_H
 
-#include <cds/intrusive/lazy_list_base.h>
+#include <mutex>        // unique_lock
+#include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/gc/nogc.h>
 
 namespace cds { namespace intrusive {
@@ -20,7 +21,7 @@ namespace cds { namespace intrusive {
             typedef Lock        lock_type   ;   ///< Lock type
             typedef Tag         tag         ;   ///< tag
 
-            CDS_ATOMIC::atomic<node *> m_pNext ; ///< pointer to the next node in the list
+            atomics::atomic<node *> m_pNext ; ///< pointer to the next node in the list
             mutable lock_type   m_Lock  ; ///< Node lock
 
             node()
@@ -93,12 +94,12 @@ namespace cds { namespace intrusive {
 
         //@cond
         // Rebind options (split-list support)
-        template <CDS_DECL_OPTIONS8>
+        template <typename... Options>
         struct rebind_options {
             typedef LazyList<
                 gc
                 , value_type
-                , typename cds::opt::make_options< options, CDS_OPTIONS8>::type
+                , typename cds::opt::make_options< options, Options...>::type
             >   type;
         };
         //@endcond
@@ -159,7 +160,7 @@ namespace cds { namespace intrusive {
         void dispose_node( node_type * pNode, Disposer disp )
         {
             clear_links( pNode );
-            cds::unref(disp)( node_traits::to_value_ptr( *pNode ));
+            disp( node_traits::to_value_ptr( *pNode ));
         }
 
         template <class Disposer>
@@ -354,7 +355,7 @@ namespace cds { namespace intrusive {
             The functor may change non-key fields of the \p item.
             While the functor \p f is calling the item \p item is locked.
 
-            You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+            You may pass \p func argument by reference using \p std::ref.
 
             Returns <tt> std::pair<bool, bool>  </tt> where \p first is true if operation is successfull,
             \p second is true if new item has been added or \p false if the item with \p key
@@ -379,7 +380,7 @@ namespace cds { namespace intrusive {
             \endcode
             where \p item is the item found, \p val is the <tt>find</tt> function argument.
 
-            You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+            You may pass \p f argument by reference using \p std::ref.
 
             The functor may change non-key fields of \p item.
             While the functor \p f is calling the item found \p item is locked.
@@ -404,7 +405,7 @@ namespace cds { namespace intrusive {
             \endcode
             where \p item is the item found, \p val is the <tt>find</tt> function argument.
 
-            You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+            You may pass \p f argument by reference using \p std::ref.
 
             The functor may change non-key fields of \p item.
             While the functor \p f is calling the item found \p item is locked.
@@ -446,7 +447,7 @@ namespace cds { namespace intrusive {
         /// Finds the key \p val
         /** \anchor cds_intrusive_LazyList_nogc_find_val
             The function searches the item with key equal to \p val
-            and returns pointer to value found or \p NULL.
+            and returns pointer to value found or \p nullptr.
         */
         template <typename Q>
         value_type * find( Q const& val )
@@ -581,7 +582,7 @@ namespace cds { namespace intrusive {
                         if ( pos.pCur != &m_Tail && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 ) {
                             // key already in the list
 
-                            cds::unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
+                            func( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
                             return std::make_pair( iterator( pos.pCur ), false );
                         }
                         else {
@@ -589,7 +590,7 @@ namespace cds { namespace intrusive {
                             link_checker::is_empty( node_traits::to_node_ptr( val ) );
 
                             link_node( node_traits::to_node_ptr( val ), pos.pPred, pos.pCur );
-                            cds::unref(func)( true, val, val );
+                            func( true, val, val );
                             ++m_ItemCounter;
                             return std::make_pair( iterator( node_traits::to_node_ptr( val )), true );
                         }
@@ -612,10 +613,10 @@ namespace cds { namespace intrusive {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
-                    cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+                    f( *node_traits::to_value_ptr( *pos.pCur ), val );
                     return true;
                 }
             }
@@ -638,7 +639,7 @@ namespace cds { namespace intrusive {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     return iterator( pos.pCur );