Correct implementation of atomic_flag_test_and_set

The function sets the flag and returns the previous value (7.17.8.1).
This commit is contained in:
emaste 2013-08-17 19:34:41 +00:00
parent 85c6da6a6e
commit 0d827ad8ca

View File

@ -381,11 +381,7 @@ static __inline _Bool
atomic_flag_test_and_set_explicit(volatile atomic_flag *__object,
memory_order __order)
{
_Bool __expected;
__expected = 0;
return (atomic_compare_exchange_strong_explicit(&__object->__flag,
&__expected, 1, __order, __order));
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
}
static __inline void