On 11/02/2011 11:25 AM, Richard Henderson wrote:
On 11/02/2011 07:18 AM, Andrew MacLeod wrote:
OK, I think i need to revert my position and introduce
__atomic_test_and_set() and __atomic_clear().  bah.  I'll work on
that today.
I don't think you do.  We already have the __sync functions,
and we should just use those.


actually, that should be sufficinent.
What we need is a preprocessor flag that tells you that you
need to use those older sync routines.

 why?

its only for the atomic_flag object that those routines are even used, so the C++ or C1x implementation of atomic_flag can just use the existing __sync routines. Since they are defined by the standard as being required to be lock free, I dont need to worry about them in the library which is what I was thinking.

I'd just change store and exchange to not try to use those patterns, and then use the sync patterns in implementing atomic_flag. They would be documented as required for that functionality.

that should work shouldnt it?
Andrew


Reply via email to