X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=mcs-lock%2Fmcs-lock.h;h=70e4019f9c9046a8242341689d51b4fd0d51a85a;hb=b684f62b7411fea476b2e1f6a8bbf920ac4c7216;hp=47c2f8f00536e06ace6da9cc668898d836fea29b;hpb=18869c55f75a2801099ef5db7b8e2b95dd2e3e7f;p=model-checker-benchmarks.git diff --git a/mcs-lock/mcs-lock.h b/mcs-lock/mcs-lock.h index 47c2f8f..70e4019 100644 --- a/mcs-lock/mcs-lock.h +++ b/mcs-lock/mcs-lock.h @@ -57,7 +57,7 @@ public: // wait on predecessor setting my flag - rl::linear_backoff bo; while ( me->gate.load(std::mo_acquire) ) { - bo.yield(); + thrd_yield(); } } } @@ -69,7 +69,8 @@ public: if ( next == NULL ) { mcs_node * tail_was_me = me; - if ( m_tail.compare_exchange( tail_was_me,NULL,std::mo_acq_rel) ) { + if ( m_tail.compare_exchange_strong( + tail_was_me,NULL,std::mo_release) ) { // got null in tail, mutex is unlocked return; } @@ -80,7 +81,7 @@ public: next = me->next.load(std::mo_acquire); if ( next != NULL ) break; - bo.yield(); + thrd_yield(); } }