diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-26 18:50:03 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-26 18:50:03 +0000 |
commit | 86c5962983c4e1f97eccfa8636ebe5bdc88599cc (patch) | |
tree | aa20f30dc112c0f53efa8a6821f2fd4bc16127b9 /CMakeLists.txt | |
parent | ef3d454616a1b1bae06f035374a64fbde5bbbfff (diff) | |
download | rspamd-86c5962983c4e1f97eccfa8636ebe5bdc88599cc.tar.gz rspamd-86c5962983c4e1f97eccfa8636ebe5bdc88599cc.zip |
Use atomic ops if possible
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 01d7d940b..6c702e76d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -923,15 +923,22 @@ CHECK_C_SOURCE_COMPILES ("#include <sys/types.h> ENDIF(NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") CHECK_C_SOURCE_RUNS(" +#include <stdbool.h> int main(int argc, char **argv) { - int a = 0; - if (__sync_bool_compare_and_swap(&a, 0, 1)) { + int a = 0, b = 0; + if (__atomic_compare_exchange_n(&a, &b, 1, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED)) { return 0; } return -1; } " HAVE_ATOMIC_BUILTINS) +IF(NOT HAVE_ATOMIC_BUILTINS) + MESSAGE(STATUS "atomic builtins are -NOT- supported") +ELSE() + MESSAGE(STATUS "atomic builtins are supported") +ENDIF() + # Check queue.h compatibility IF(NOT HAVE_COMPATIBLE_QUEUE_H) INCLUDE_DIRECTORIES(compat) |