X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker-benchmarks.git;a=blobdiff_plain;f=mpmc-queue%2Fmpmc-queue.h;h=918415fa99278e0a8cc3d47622f84de00749445c;hp=f73ab992e0b1fcfbbf962b067c204cdb75b9578f;hb=77847ecd3fa6a643302770491928787ba143cde1;hpb=ca67665a06590d48352fd2c601004a39bd993ca8 diff --git a/mpmc-queue/mpmc-queue.h b/mpmc-queue/mpmc-queue.h index f73ab99..918415f 100644 --- a/mpmc-queue/mpmc-queue.h +++ b/mpmc-queue/mpmc-queue.h @@ -38,12 +38,14 @@ public: if ( m_rdwr.compare_exchange_weak(rdwr,rdwr+(1<<16),mo_acq_rel) ) break; + else + thrd_yield(); } // (*1) rl::backoff bo; while ( (m_written.load(mo_acquire) & 0xFFFF) != wr ) { - bo.yield(); + thrd_yield(); } t_element * p = & ( m_array[ rd % t_size ] ); @@ -69,12 +71,14 @@ public: if ( m_rdwr.compare_exchange_weak(rdwr,(rd<<16) | ((wr+1)&0xFFFF),mo_acq_rel) ) break; + else + thrd_yield(); } // (*1) rl::backoff bo; while ( (m_read.load(mo_acquire) & 0xFFFF) != rd ) { - bo.yield(); + thrd_yield(); } t_element * p = & ( m_array[ wr % t_size ] );