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 47c2f8f..2d39f2f 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 fdfbb36..f73ab99 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;
                }