svn commit: r254465 - head/sys/sys

Ed Maste emaste at FreeBSD.org
Sat Aug 17 19:34:42 UTC 2013


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


More information about the svn-src-head mailing list