From: Brian Norris Date: Wed, 10 Oct 2012 22:20:17 +0000 (-0700) Subject: benchmarks: revert back to strong/weak compare-exchange X-Git-Tag: pldi2013~47 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker-benchmarks.git;a=commitdiff_plain;h=ca67665a06590d48352fd2c601004a39bd993ca8 benchmarks: revert back to strong/weak compare-exchange I fixed up the model-checker header, so these will compile. --- diff --git a/mcs-lock/mcs-lock.h b/mcs-lock/mcs-lock.h index 47c2f8f..2d39f2f 100644 --- a/mcs-lock/mcs-lock.h +++ b/mcs-lock/mcs-lock.h @@ -69,7 +69,7 @@ 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_acq_rel) ) { // got null in tail, mutex is unlocked return; } diff --git a/mpmc-queue/mpmc-queue.h b/mpmc-queue/mpmc-queue.h index fdfbb36..f73ab99 100644 --- a/mpmc-queue/mpmc-queue.h +++ b/mpmc-queue/mpmc-queue.h @@ -36,7 +36,7 @@ public: if ( wr == rd ) // empty return false; - if ( m_rdwr.compare_exchange(rdwr,rdwr+(1<<16),mo_acq_rel) ) + if ( m_rdwr.compare_exchange_weak(rdwr,rdwr+(1<<16),mo_acq_rel) ) break; } @@ -67,7 +67,7 @@ public: if ( wr == ((rd + t_size)&0xFFFF) ) // full return NULL; - if ( m_rdwr.compare_exchange(rdwr,(rd<<16) | ((wr+1)&0xFFFF),mo_acq_rel) ) + if ( m_rdwr.compare_exchange_weak(rdwr,(rd<<16) | ((wr+1)&0xFFFF),mo_acq_rel) ) break; }