make warnings go away
authorbdemsky <bdemsky@uci.edu>
Wed, 10 Sep 2014 21:32:11 +0000 (14:32 -0700)
committerbdemsky <bdemsky@uci.edu>
Wed, 10 Sep 2014 21:32:11 +0000 (14:32 -0700)
chase-lev-deque-bugfix/deque.h
mpmc-queue/mpmc-queue.cc
mpmc-queue/mpmc-queue.h

index bc670e7..f474355 100644 (file)
@@ -15,6 +15,7 @@ Deque * create();
 int take(Deque *q);
 void resize(Deque *q);
 void push(Deque *q, int x);
+int steal(Deque *q);
 
 #define EMPTY 0xffffffff
 #define ABORT 0xfffffffe
index b62d8d3..7de14d5 100644 (file)
@@ -18,7 +18,7 @@ void threadA(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
 void threadB(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
 {
        int32_t *bin;
-       while (bin = queue->read_fetch()) {
+       while ((bin = queue->read_fetch()) != NULL) {
                printf("Read: %d\n", load_32(bin));
                queue->read_consume();
        }
@@ -30,7 +30,7 @@ void threadC(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
        store_32(bin, 1);
        queue->write_publish();
 
-       while (bin = queue->read_fetch()) {
+       while ((bin = queue->read_fetch()) != NULL) {
                printf("Read: %d\n", load_32(bin));
                queue->read_consume();
        }
index 918415f..47af8ea 100644 (file)
@@ -34,7 +34,7 @@ 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;