diff options
author | emaste <emaste@FreeBSD.org> | 2013-08-17 19:34:41 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-08-17 19:34:41 +0000 |
commit | 0d827ad8ca8662047131c7e327a5d0914c38d88f (patch) | |
tree | 2ddcdfbeea523a6b79c9c06e0989e9bcff30eb24 /sys | |
parent | 85c6da6a6e4293c3228d01763fce65a1b0ac878d (diff) | |
download | FreeBSD-src-0d827ad8ca8662047131c7e327a5d0914c38d88f.zip FreeBSD-src-0d827ad8ca8662047131c7e327a5d0914c38d88f.tar.gz |
Correct implementation of atomic_flag_test_and_set
The function sets the flag and returns the previous value (7.17.8.1).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/stdatomic.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sys/sys/stdatomic.h b/sys/sys/stdatomic.h index 054ded6..37c3a06 100644 --- a/sys/sys/stdatomic.h +++ b/sys/sys/stdatomic.h @@ -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 |