From ca67665a06590d48352fd2c601004a39bd993ca8 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 10 Oct 2012 15:20:17 -0700 Subject: [PATCH 1/1] benchmarks: revert back to strong/weak compare-exchange I fixed up the model-checker header, so these will compile. --- mcs-lock/mcs-lock.h | 2 +- mpmc-queue/mpmc-queue.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.34.1