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 */
@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