Makefiles: use appropriate preprocessor vs. compiler flags
[model-checker-benchmarks.git] / mpmc-queue / mpmc-queue.h
index fdfbb36..918415f 100644 (file)
@@ -36,14 +36,16 @@ public:
                        if ( wr == rd ) // empty
                                return false;
 
                        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;
                                break;
+                       else
+                               thrd_yield();
                }
 
                // (*1)
                rl::backoff bo;
                while ( (m_written.load(mo_acquire) & 0xFFFF) != wr ) {
                }
 
                // (*1)
                rl::backoff bo;
                while ( (m_written.load(mo_acquire) & 0xFFFF) != wr ) {
-                       bo.yield();
+                       thrd_yield();
                }
 
                t_element * p = & ( m_array[ rd % t_size ] );
                }
 
                t_element * p = & ( m_array[ rd % t_size ] );
@@ -67,14 +69,16 @@ public:
                        if ( wr == ((rd + t_size)&0xFFFF) ) // full
                                return NULL;
 
                        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;
                                break;
+                       else
+                               thrd_yield();
                }
 
                // (*1)
                rl::backoff bo;
                while ( (m_read.load(mo_acquire) & 0xFFFF) != rd ) {
                }
 
                // (*1)
                rl::backoff bo;
                while ( (m_read.load(mo_acquire) & 0xFFFF) != rd ) {
-                       bo.yield();
+                       thrd_yield();
                }
 
                t_element * p = & ( m_array[ wr % t_size ] );
                }
 
                t_element * p = & ( m_array[ wr % t_size ] );