[rtems commit] add compare_and_swap check in check-atomic.m4

Sebastian Huber sebh at rtems.org
Tue Aug 20 08:37:14 UTC 2013


Module:    rtems
Branch:    master
Commit:    0432dff73fbcf73ed75a02c07fe0f0690b306aee
Changeset: http://git.rtems.org/rtems/commit/?id=0432dff73fbcf73ed75a02c07fe0f0690b306aee

Author:    WeiY <wei.a.yang at gmail.com>
Date:      Mon Aug 19 23:36:28 2013 +0800

add compare_and_swap check in check-atomic.m4

---

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

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"])




More information about the vc mailing list