提交 3d8905f8 编写于 作者: R Rich Salz 提交者: Pauli

Fix error-checking compiles for mutex

Fixes: #14229
Reviewed-by: NKurt Roeckx <kurt@roeckx.be>
Reviewed-by: NPaul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14264)
上级 0a8e6c1f
...@@ -1666,6 +1666,13 @@ most UNIX/Linux systems), and Windows threads. No other threading models are ...@@ -1666,6 +1666,13 @@ most UNIX/Linux systems), and Windows threads. No other threading models are
supported. If your platform does not provide pthreads or Windows threads then supported. If your platform does not provide pthreads or Windows threads then
you should use `Configure` with the `no-threads` option. you should use `Configure` with the `no-threads` option.
For pthreads, all locks are non-recursive. In addition, in a debug build,
the mutex attribute `PTHREAD_MUTEX_ERRORCHECK` is used. If this is not
available on your platform, you might have to add
`-DOPENSSL_NO_MUTEX_ERRORCHECK` to your `Configure` invocation.
(On Linux `PTHREAD_MUTEX_ERRORCHECK` is an enum value, so a built-in
ifdef test cannot be used.)
Notes on shared libraries Notes on shared libraries
------------------------- -------------------------
......
...@@ -55,7 +55,7 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void) ...@@ -55,7 +55,7 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
* We don't use recursive mutexes, but try to catch errors if we do. * We don't use recursive mutexes, but try to catch errors if we do.
*/ */
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
# if defined(NDEBUG) && defined(PTHREAD_MUTEX_ERRORCHECK) # if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
# else # else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册