Fixed memory ordering
[libcds.git] / cds / intrusive / impl / ellen_bintree.h
index 48154282f9b0732751c1fe8df8f12b46265946cd..974854b48fac1972b17a30597e8318b30439b532 100644 (file)
@@ -1159,7 +1159,7 @@ namespace cds { namespace intrusive {
             // Unflag parent
             update_ptr cur( pOp, update_desc::IFlag );
             CDS_VERIFY( pOp->iInfo.pParent->m_pUpdate.compare_exchange_strong( cur, pOp->iInfo.pParent->null_update_desc(),
-                memory_model::memory_order_acquire, atomics::memory_order_relaxed ));
+                memory_model::memory_order_release, atomics::memory_order_relaxed ));
         }
 
         bool check_delete_precondition( search_result& res ) const
@@ -1179,7 +1179,7 @@ namespace cds { namespace intrusive {
             update_ptr pUpdate( pOp->dInfo.pUpdateParent );
             update_ptr pMark( pOp, update_desc::Mark );
             if ( pOp->dInfo.pParent->m_pUpdate.compare_exchange_strong( pUpdate, pMark, // *
-                memory_model::memory_order_release, atomics::memory_order_relaxed ))
+                memory_model::memory_order_acquire, atomics::memory_order_relaxed ))
             {
                 help_marked( pOp );
 
@@ -1198,7 +1198,7 @@ namespace cds { namespace intrusive {
                 // Undo grandparent dInfo
                 update_ptr pDel( pOp, update_desc::DFlag );
                 if ( pOp->dInfo.pGrandParent->m_pUpdate.compare_exchange_strong( pDel, pOp->dInfo.pGrandParent->null_update_desc(),
-                    memory_model::memory_order_acquire, atomics::memory_order_relaxed ))
+                    memory_model::memory_order_release, atomics::memory_order_relaxed ))
                 {
                     retire_update_desc( pOp );
                 }
@@ -1234,7 +1234,7 @@ namespace cds { namespace intrusive {
 
             update_ptr upd( pOp, update_desc::DFlag );
             CDS_VERIFY( pOp->dInfo.pGrandParent->m_pUpdate.compare_exchange_strong( upd, pOp->dInfo.pGrandParent->null_update_desc(),
-                memory_model::memory_order_acquire, atomics::memory_order_relaxed ));
+                memory_model::memory_order_release, atomics::memory_order_relaxed ));
         }
 
         bool try_insert( value_type& val, internal_node * pNewInternal, search_result& res )
@@ -1281,7 +1281,7 @@ namespace cds { namespace intrusive {
 
                 update_ptr updCur( res.updParent.ptr());
                 if ( res.pParent->m_pUpdate.compare_exchange_strong( updCur, update_ptr( pOp, update_desc::IFlag ),
-                    memory_model::memory_order_release, atomics::memory_order_relaxed )) {
+                    memory_model::memory_order_acq_rel, atomics::memory_order_relaxed )) {
                     // do insert
                     help_insert( pOp );
                     retire_update_desc( pOp );
@@ -1327,7 +1327,7 @@ namespace cds { namespace intrusive {
 
                         update_ptr updGP( res.updGrandParent.ptr());
                         if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ),
-                            memory_model::memory_order_release, atomics::memory_order_relaxed )) {
+                            memory_model::memory_order_acquire, atomics::memory_order_relaxed )) {
                             if ( help_delete( pOp )) {
                                 // res.pLeaf is not deleted yet since it is guarded
                                 f( *node_traits::to_value_ptr( res.pLeaf ));
@@ -1378,7 +1378,7 @@ namespace cds { namespace intrusive {
 
                         update_ptr updGP( res.updGrandParent.ptr());
                         if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ),
-                            memory_model::memory_order_release, atomics::memory_order_relaxed )) {
+                            memory_model::memory_order_acquire, atomics::memory_order_relaxed )) {
                             if ( help_delete( pOp ))
                                 break;
                             pOp = nullptr;
@@ -1445,7 +1445,7 @@ namespace cds { namespace intrusive {
 
                         update_ptr updGP( res.updGrandParent.ptr());
                         if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ),
-                                memory_model::memory_order_release, atomics::memory_order_relaxed ))
+                                memory_model::memory_order_acquire, atomics::memory_order_relaxed ))
                         {
                             if ( help_delete( pOp ))
                                 break;
@@ -1494,7 +1494,7 @@ namespace cds { namespace intrusive {
 
                         update_ptr updGP( res.updGrandParent.ptr());
                         if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ),
-                            memory_model::memory_order_release, atomics::memory_order_relaxed ))
+                            memory_model::memory_order_acquire, atomics::memory_order_relaxed ))
                         {
                             if ( help_delete( pOp ))
                                 break;