
On Sun, Oct 2, 2011 at 2:09 PM, Hans Boehm <Hans.Boehm@hp.com> wrote:
I think I see what you're doing. By embedding the state of the queue into the same atomic object as the lock set bit, you can rely on single-location cache coherence to get the right ordering. That can be made to work for the low- level bit-twiddling implementation, but not for a more generic approach that keeps the queue and the lock-bit itself separate. I would still much rather see a default that works for the full solution space. I prefer to have people like us who are sometimes willing to go through subtle reasoning about memory ordering add the annotations, rather than insisting that the average programmer who has never heard of these issues add them to avoid subtle bugs.
Hans
I think that is the essence of the discussion. I would say that Alexander is of the opinion that the new atomics should have been written for lock-free expert, whereas you might want them approachable by the average programmer. I worry about given atomics to the average programmer. Maybe they should have been harder to type than reinterpret_cast. I fully expect most uses (outside a library) to be incorrect. Tony