X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=mpmc-queue%2Fmpmc-queue.h;h=fa5f37a1cf054634bdb4d9c152ef7299ed7f6b63;hb=1438eb7c0715e53611a717e593bfa3fe1bd30588;hp=47af8eab37b7509ca8e257e118c5b7e38ec8278a;hpb=5ab6d890042234648c0baec333ed65e90ca055cf;p=model-checker-benchmarks.git diff --git a/mpmc-queue/mpmc-queue.h b/mpmc-queue/mpmc-queue.h index 47af8ea..fa5f37a 100644 --- a/mpmc-queue/mpmc-queue.h +++ b/mpmc-queue/mpmc-queue.h @@ -27,6 +27,8 @@ public: //----------------------------------------------------- t_element * read_fetch() { + // FIXME: We can have a relaxed for sure here since the next CAS + // will fix the problem unsigned int rdwr = m_rdwr.load(mo_acquire); unsigned int rd,wr; for(;;) { @@ -35,7 +37,7 @@ public: if ( wr == rd ) // empty return NULL; - + if ( m_rdwr.compare_exchange_weak(rdwr,rdwr+(1<<16),mo_acq_rel) ) break; else @@ -60,6 +62,8 @@ public: //----------------------------------------------------- t_element * write_prepare() { + // FIXME: We can have a relaxed for sure here since the next CAS + // will fix the problem unsigned int rdwr = m_rdwr.load(mo_acquire); unsigned int rd,wr; for(;;) {