Boost logo

Boost Users :

Subject: [Boost-users] [Boost.Atomic] Wait-free multi-producer queue example bug?
From: Ioannis Papadopoulos (ipapadop_at_[hidden])
Date: 2013-05-16 17:20:15


Hi,

In
http://www.boost.org/doc/libs/1_53_0/doc/html/atomic/usage_examples.html#boost_atomic.usage_examples.mp_queue
I see that pop_all_reverse() is implemented as:

node * pop_all_reverse(void)
{
   return head_.exchange(0, boost::memory_order_consume);
}

Shouldn't the memory order be memory_order_acquire in this example? If
I'm not mistaken, at least an acquire is required to see all the writes
from the thread that did the release.

GCC 4.8 also complains that memory_order_consume is not a correct memory
ordering for exchange.

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net