[PATCH] add compare_and_swap check in check-atomic.m4

WeiY wei.a.yang at gmail.com
Mon Aug 19 15:36:28 UTC 2013


---
 cpukit/aclocal/check-atomic.m4 |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpukit/aclocal/check-atomic.m4 b/cpukit/aclocal/check-atomic.m4
index 00149f8..69cca50 100644
--- a/cpukit/aclocal/check-atomic.m4
+++ b/cpukit/aclocal/check-atomic.m4
@@ -7,9 +7,11 @@ AC_CACHE_CHECK([whether CPU supports atomic operations],
   [rtems_cv_ATOMIC],[
     AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([[#include <stdatomic.h>]],
-        [[atomic_uint_fast32_t t; atomic_init(&t, 0); 
+        [[atomic_uint_fast32_t t; uint_fast32_t m = 1;
+          atomic_init(&t, 0); 
           atomic_store( &t, 1 );
           atomic_exchange( &t, 2 );
+          atomic_compare_exchange_strong( &t, &m, 2);
           atomic_fetch_add( &t, 3 );]])],
         [rtems_cv_ATOMIC="yes"],
         [rtems_cv_ATOMIC="no"])
-- 
1.7.9.5




More information about the devel mailing list