Subj : Re: atomic operations api added to AppCore... To : comp.programming.threads From : awaken Date : Fri Feb 25 2005 02:54 am So is it correct code for StabilizeRight ? void StabilizeRight(const AnchorType lrs) { HPRecType *hp0 = lrs.left; // haz ptr HPRecType *hp1 = lrs.right; if( m_anchor.anchor != lrs.anchor) // 64bit compare return; NodeType *pprev = lrs.right->left; NodeType *hp2 = pprev; if( m_anchor.anchor != lrs.anchor ) return; NodeType *prevnext = pprev->right; if(prevnext != lrs.right) { if( m_anchor.anchor != lrs.anchor ) return; if(! CAS(&pprev->right, prevnext, lrs.right) ) return; } CAS64( &m_anchor.anchor, lrs, AnchorType(lrs.left, lrs.right, eStable); } // I use 64bit CAS on IA-32, so Anchor type // defined to hold 2 32-bit pointers // struct AnchorType { union { unsigned __int64 anchor; // 64bit type in MSVC++ unsigned int StatusType:2; struct { PackedPtr< NodeType > left; // 32 bit, 2 shared w/Status PackedPtr< NodeType > right; // 32 bit }; } ; .