Fixed bug in MichaelLit<RCU>
authorkhizmax <libcds.dev@gmail.com>
Sun, 1 Nov 2015 15:34:54 +0000 (18:34 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 1 Nov 2015 15:34:54 +0000 (18:34 +0300)
cds/intrusive/michael_list_rcu.h

index 4fd6f839c914fa291e1d3943c199387f0fa4706c..b77cc9e880f4ec02484a21301f18621974de48f0 100644 (file)
@@ -957,18 +957,21 @@ namespace cds { namespace intrusive {
             back_off bkoff;
             check_deadlock_policy::check();
 
+            node_type * pDel;
             for (;;) {
                 {
                     rcu_lock l;
                     if ( !search( pos.refHead, val, pos, cmp ) )
                         return false;
+                    // store pCur since it may be changed by unlink_node() slow path
+                    pDel = pos.pCur;
                     if ( !unlink_node( pos, erase_mask )) {
                         bkoff();
                         continue;
                     }
                 }
-
-                f( *node_traits::to_value_ptr( *pos.pCur ) );
+                assert( pDel );
+                f( *node_traits::to_value_ptr( pDel ) );
                 --m_ItemCounter;
                 return true;
             }