changes
[model-checker-benchmarks.git] / mpmc-queue / mpmc-queue.h
index 918415fa99278e0a8cc3d47622f84de00749445c..fa5f37a1cf054634bdb4d9c152ef7299ed7f6b63 100644 (file)
@@ -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(;;) {
@@ -34,8 +36,8 @@ public:
                        wr = rdwr & 0xFFFF;
 
                        if ( wr == rd ) // empty
-                               return false;
-
+                               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(;;) {