]> git.kaiwu.me - nginx.git/commitdiff
atomic operations test-run
authorIgor Sysoev <igor@sysoev.ru>
Fri, 27 Nov 2009 22:00:39 +0000 (22:00 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 27 Nov 2009 22:00:39 +0000 (22:00 +0000)
auto/cc/conf
auto/lib/libatomic/conf

index 8916ad095f0e21a6fb6b2421473eea428746f054..a7c8a0946d0e2d512f0c1b8e206392628258a5c5 100644 (file)
@@ -127,13 +127,18 @@ if [ "$NGX_PLATFORM" != win32 ]; then
 
     ngx_feature="gcc builtin atomic operations"
     ngx_feature_name=NGX_HAVE_GCC_ATOMIC
-    ngx_feature_run=no
+    ngx_feature_run=yes
     ngx_feature_incs=
     ngx_feature_path=
     ngx_feature_libs=
-    ngx_feature_test="long  n;
-                      __sync_bool_compare_and_swap(&n, 0, 1);
-                      __sync_fetch_and_add(&n, 1);"
+    ngx_feature_test="long  n = 0;
+                      if (!__sync_bool_compare_and_swap(&n, 0, 1))
+                          return 1;
+                      if (__sync_fetch_and_add(&n, 1) != 1)
+                          return 1;
+                      if (n != 2)
+                          return 1;
+                      __sync_synchronize();"
     . auto/feature
 
 
index a06ab1a882af9f06f8f06ff5f7099927894399a2..214feb37a92f826acb4d97e57fefb4f9ba6d526c 100644 (file)
@@ -13,15 +13,18 @@ else
 
     ngx_feature="atomic_ops library"
     ngx_feature_name=NGX_HAVE_LIBATOMIC
-    ngx_feature_run=no
+    ngx_feature_run=yes
     ngx_feature_incs="#include <atomic_ops.h>"
     ngx_feature_path=
     ngx_feature_libs="-latomic_ops"
-    ngx_feature_test="AO_t *n;
-                      AO_compare_and_swap(n, 0, 1);
-                      AO_fetch_and_add(n, 1);
+    ngx_feature_test="long  n = 0;
+                      if (!AO_compare_and_swap(&n, 0, 1))
+                          return 1;
+                      if (AO_fetch_and_add(&n, 1) != 1)
+                          return 1;
+                      if (n != 2)
+                          return 1;
                       AO_nop();"
-
     . auto/feature
 
     if [ $ngx_found = yes ]; then