benchmarks: revert back to strong/weak compare-exchange
authorBrian Norris <banorris@uci.edu>
Wed, 10 Oct 2012 22:20:17 +0000 (15:20 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 10 Oct 2012 22:20:17 +0000 (15:20 -0700)
I fixed up the model-checker header, so these will compile.

mcs-lock/mcs-lock.h
mpmc-queue/mpmc-queue.h

index 47c2f8f00536e06ace6da9cc668898d836fea29b..2d39f2f6cab8d2aa5b10f5cd6e1b9092a818955e 100644 (file)
@@ -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;
                        }
index fdfbb365164a0ab8ef0ab87e75b044b62cae6388..f73ab992e0b1fcfbbf962b067c204cdb75b9578f 100644 (file)
@@ -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;
                }