diff options
author | Richard Levitte <levitte@openssl.org> | 2016-08-24 13:03:20 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-08-24 14:37:30 +0100 |
commit | cb4b54c23b95e4638d643eb349d8d8dfa1cc2fd3 (patch) | |
tree | 39661cd8c91114d12ff01f6c0df37643a6bdddc0 /crypto/threads_pthread.c | |
parent | 63db6b772fa264a62927f6a3584733192dc5a352 (diff) | |
download | openssl-cb4b54c23b95e4638d643eb349d8d8dfa1cc2fd3.tar.gz |
Check for __GNUC__ to use GNU C atomic buildins
Note: we trust any other compiler that fully implements GNU extension
to define __GNUC__
RT#4642
Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'crypto/threads_pthread.c')
-rw-r--r-- | crypto/threads_pthread.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c index 6f5e812d97..72ea83892b 100644 --- a/crypto/threads_pthread.c +++ b/crypto/threads_pthread.c @@ -109,9 +109,9 @@ int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b) int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) { -#ifdef __ATOMIC_RELAXED +# if defined(__GNUC__) && defined(__ATOMIC_RELAXED) *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED); -#else +# else if (!CRYPTO_THREAD_write_lock(lock)) return 0; @@ -120,7 +120,7 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) if (!CRYPTO_THREAD_unlock(lock)) return 0; -#endif +# endif return 1; } |