minor fix
[cdsspec-compiler.git] / benchmark / mpmc-queue / mpmc-queue.cc
index 0785711ff6c86dd34335132f1f16b8747ae43bf3..bf172ea1ef4f4900361d27f72274cd791891335c 100644 (file)
@@ -11,7 +11,8 @@
 void threadA(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
 {
        int32_t *bin = queue->write_prepare();
-       store_32(bin, 1);
+       //store_32(bin, 1);
+       *bin = 1;
        printf("write_bin %d, val %d\n", bin, 1);
        queue->write_publish(bin);
 }
@@ -20,21 +21,24 @@ void threadB(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
 {
        int32_t *bin;
        while (bin = queue->read_fetch()) {
-               printf("Read: %d\n", load_32(bin));
-               printf("read_bin %d, val %d\n", bin, load_32(bin));
-               queue->read_consume();
+               //printf("Read: %d\n", load_32(bin));
+               //printf("read_bin %d, val %d\n", bin, load_32(bin));
+               printf("Read: %d\n", *bin);
+               queue->read_consume(bin);
        }
 }
 
 void threadC(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
 {
        int32_t *bin = queue->write_prepare();
-       store_32(bin, 1);
+       //store_32(bin, 1);
+       *bin = 1;
        queue->write_publish(bin);
 
        while (bin = queue->read_fetch()) {
-               printf("Read: %d\n", load_32(bin));
-               queue->read_consume();
+               //printf("Read: %d\n", load_32(bin));
+               printf("Read: %d\n", *bin);
+               queue->read_consume(bin);
        }
 }
 
@@ -104,7 +108,7 @@ void process_params(int argc, char **argv)
 
 int user_main(int argc, char **argv)
 {
-       struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> queue;
+       struct mpmc_boundq_1_alt<int32_t, 2> queue;
        thrd_t A[MAXWRITERS], B[MAXREADERS], C[MAXRDWR];
 
        /* Note: optarg() / optind is broken in model-checker - workaround is
@@ -115,7 +119,8 @@ int user_main(int argc, char **argv)
 #ifndef CONFIG_MPMC_NO_INITIAL_ELEMENT
        printf("Adding initial element\n");
        int32_t *bin = queue.write_prepare();
-       store_32(bin, 17);
+       //store_32(bin, 17);
+       *bin, 17;
        printf("init_write_bin %d, val %d\n", bin, 17);
        queue.write_publish(bin);
 #endif