changes
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 15 Jan 2015 01:59:08 +0000 (17:59 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 15 Jan 2015 01:59:08 +0000 (17:59 -0800)
benchmark/ms-queue/my_queue.c

index fe4da51fe7275a87dd062a6fef9af7152c46855f..f59d77736a13ec6b4d343772a6a0117c921123bf 100644 (file)
@@ -63,6 +63,9 @@ static void reclaim(unsigned int node)
 void init_queue(queue_t *q, int num_threads)
 {
        int i, j;
+       for (i = 0; i < MAX_NODES; i++) {
+               atomic_init(&q->nodes[i].next, MAKE_POINTER(POISON_IDX, 0));
+       }
 
        /* Initialize each thread's free list with INITIAL_FREE pointers */
        /* The actual nodes are initialized with poison indexes */
@@ -191,11 +194,11 @@ bool dequeue(queue_t *q, int *retVal)
                        @Label: Dequeue_Read_Head
                        @End
                */
-               /** A new bug has been found here!!! It should be acquire instead of
+               /** FIXME: A new bug has been found here!!! It should be acquire instead of
                 * relaxed (it introduces a bug when there's two dequeuers and one
                 * enqueuer)
                 */
-               tail = atomic_load_explicit(&q->tail, acquire);
+               tail = atomic_load_explicit(&q->tail, relaxed);
                /**
                        @Begin
                        @Potential_commit_point_define: true