提交 f49452c2 编写于 作者: P Pauli

Return a value from atomic read on Windows.

Use a read lock when reading using pthreads.
Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4517)
上级 19f05ebc
...@@ -177,7 +177,7 @@ int CRYPTO_atomic_read(int *val, int *ret, CRYPTO_RWLOCK *lock) ...@@ -177,7 +177,7 @@ int CRYPTO_atomic_read(int *val, int *ret, CRYPTO_RWLOCK *lock)
return 1; return 1;
} }
# endif # endif
if (!CRYPTO_THREAD_write_lock(lock)) if (!CRYPTO_THREAD_read_lock(lock))
return 0; return 0;
*ret = *val; *ret = *val;
......
...@@ -135,7 +135,7 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) ...@@ -135,7 +135,7 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
int CRYPTO_atomic_read(int *val, int *ret, CRYPTO_RWLOCK *lock) int CRYPTO_atomic_read(int *val, int *ret, CRYPTO_RWLOCK *lock)
{ {
InterlockedCompareExchange(val, 0, 0); *ret = InterlockedCompareExchange(val, 0, 0);
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册