mirror of
https://github.com/nginx/nginx.git
synced 2025-08-06 14:56:15 +08:00
atomic operations test-run
This commit is contained in:
parent
d5624689cb
commit
37835d9056
13
auto/cc/conf
13
auto/cc/conf
@ -127,13 +127,18 @@ if [ "$NGX_PLATFORM" != win32 ]; then
|
|||||||
|
|
||||||
ngx_feature="gcc builtin atomic operations"
|
ngx_feature="gcc builtin atomic operations"
|
||||||
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
|
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
|
||||||
ngx_feature_run=no
|
ngx_feature_run=yes
|
||||||
ngx_feature_incs=
|
ngx_feature_incs=
|
||||||
ngx_feature_path=
|
ngx_feature_path=
|
||||||
ngx_feature_libs=
|
ngx_feature_libs=
|
||||||
ngx_feature_test="long n;
|
ngx_feature_test="long n = 0;
|
||||||
__sync_bool_compare_and_swap(&n, 0, 1);
|
if (!__sync_bool_compare_and_swap(&n, 0, 1))
|
||||||
__sync_fetch_and_add(&n, 1);"
|
return 1;
|
||||||
|
if (__sync_fetch_and_add(&n, 1) != 1)
|
||||||
|
return 1;
|
||||||
|
if (n != 2)
|
||||||
|
return 1;
|
||||||
|
__sync_synchronize();"
|
||||||
. auto/feature
|
. auto/feature
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,15 +13,18 @@ else
|
|||||||
|
|
||||||
ngx_feature="atomic_ops library"
|
ngx_feature="atomic_ops library"
|
||||||
ngx_feature_name=NGX_HAVE_LIBATOMIC
|
ngx_feature_name=NGX_HAVE_LIBATOMIC
|
||||||
ngx_feature_run=no
|
ngx_feature_run=yes
|
||||||
ngx_feature_incs="#include <atomic_ops.h>"
|
ngx_feature_incs="#include <atomic_ops.h>"
|
||||||
ngx_feature_path=
|
ngx_feature_path=
|
||||||
ngx_feature_libs="-latomic_ops"
|
ngx_feature_libs="-latomic_ops"
|
||||||
ngx_feature_test="AO_t *n;
|
ngx_feature_test="long n = 0;
|
||||||
AO_compare_and_swap(n, 0, 1);
|
if (!AO_compare_and_swap(&n, 0, 1))
|
||||||
AO_fetch_and_add(n, 1);
|
return 1;
|
||||||
|
if (AO_fetch_and_add(&n, 1) != 1)
|
||||||
|
return 1;
|
||||||
|
if (n != 2)
|
||||||
|
return 1;
|
||||||
AO_nop();"
|
AO_nop();"
|
||||||
|
|
||||||
. auto/feature
|
. auto/feature
|
||||||
|
|
||||||
if [ $ngx_found = yes ]; then
|
if [ $ngx_found = yes ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user