I\'ve written a container for a very simple piece of data that needs to be synchronized across threads. I want the top performance. I don\'t want to use locks.<
Leaving to one side the difficulty of implementing the pop operation, I think memory_order_relaxed
is inadequate. Before pushing the node, one assumes that some value(s) will be written into to it, which will be read when the node is popped. You need some synchronization mechanism to ensure that the values have actually been written before they are read. memory_order_relaxed
is not providing that synchronization... memory_order_acquire
/memory_order_release
would.