On 13-Feb-18 7:37 PM, Alex Kiselev wrote:
Hi.
I've been wondering should I use a release/acquire memory barrier pair
in order to be sure that the other thread will see the fully/corrected
initialized object
passed to it via a dpdk ring or ring itself is a kind of barrier?
Let's say I have a pseudo code:
Thread1:
obj = alloc();
...
obj initialization
...
??? fence(memory_order_release); ???
rte_ring_sp_enqueue(ring, obj)
Thread2:
??? fence(memory_order_acquire); ???
rte_ring_sc_dequeue(ring, obj)
Should I use fences in that code?
Thanks.
--
Alex
Rings do that automatically, no additional fences needed.
--
Thanks,
Anatoly