Uses different pass count for different parallel queue test cases
[libcds.git] / cds / urcu / raw_ptr.h
index 81ef76f0d9a82fc6555555d43c0230d24e72e63b..c9bb2fc5bceb7461b1f3c763eccdcc65487a4ef9 100644 (file)
@@ -1,4 +1,32 @@
-//$$CDS-header$$
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
 
 #ifndef CDSLIB_URCU_RAW_PTR_H
 #define CDSLIB_URCU_RAW_PTR_H
@@ -19,7 +47,7 @@ namespace cds { namespace urcu {
         outside RCU lock.
 
         The object of \p %raw_ptr solves that problem: it contains the pointer to the node found
-        and a chain of nodes that were reclaimed during traversing. The \p %raw_ptr object destructor
+        and a chain of nodes that were be reclaimed during traversing. The \p %raw_ptr object destructor
         frees the chain (but not the node found) passing it to RCU \p batch_retire().
 
         The object of \p %raw_ptr class must be destructed only outside RCU-lock of current thread.
@@ -108,16 +136,12 @@ namespace cds { namespace urcu {
         /// Move assignment operator
         /**
             This operator may be called only inside RCU-lock.
-            The \p this should be empty.
         */
         raw_ptr& operator=( raw_ptr&& p ) CDS_NOEXCEPT
         {
-            assert( empty() );
-            if ( !rcu::is_locked() )
-                release();
-
+            assert( rcu::is_locked());
             m_ptr = p.m_ptr;
-            m_Enum = std::move( p.m_Enum );
+            m_Enum.combine(  std::move( p.m_Enum ));
             p.m_ptr = nullptr;
             return *this;
         }