Author: emaste
Date: Sat Aug 17 19:34:41 2013
New Revision: 254465
URL: http://svnweb.freebsd.org/changeset/base/254465

Log:
  Correct implementation of atomic_flag_test_and_set
  
  The function sets the flag and returns the previous value (7.17.8.1).

Modified:
  head/sys/sys/stdatomic.h

Modified: head/sys/sys/stdatomic.h
==============================================================================
--- head/sys/sys/stdatomic.h    Sat Aug 17 19:29:51 2013        (r254464)
+++ head/sys/sys/stdatomic.h    Sat Aug 17 19:34:41 2013        (r254465)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to