summaryrefslogtreecommitdiffstats
path: root/sys/sys/stdatomic.h
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2013-08-17 19:34:41 +0000
committeremaste <emaste@FreeBSD.org>2013-08-17 19:34:41 +0000
commit0d827ad8ca8662047131c7e327a5d0914c38d88f (patch)
tree2ddcdfbeea523a6b79c9c06e0989e9bcff30eb24 /sys/sys/stdatomic.h
parent85c6da6a6e4293c3228d01763fce65a1b0ac878d (diff)
downloadFreeBSD-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/sys/stdatomic.h')
-rw-r--r--sys/sys/stdatomic.h6
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
OpenPOWER on IntegriCloud