summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-08-31 18:54:16 +0100
committerHugo Landau <hlandau@openssl.org>2023-09-05 11:45:44 +0100
commit17a0e930d2607e1d571c82912d5e1fa3393b2053 (patch)
treed37ce804c5d2ed697610dc8608c16025f6a0080d
parentd4231af60a8d04196b3b873c2fa8638daff36173 (diff)
MUTEX: Assert on locking failure
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21919)
-rw-r--r--crypto/thread/arch/thread_posix.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/thread/arch/thread_posix.c b/crypto/thread/arch/thread_posix.c
index 0ab27b1230..f88323820f 100644
--- a/crypto/thread/arch/thread_posix.c
+++ b/crypto/thread/arch/thread_posix.c
@@ -120,18 +120,22 @@ int ossl_crypto_mutex_try_lock(CRYPTO_MUTEX *mutex)
void ossl_crypto_mutex_lock(CRYPTO_MUTEX *mutex)
{
+ int rc;
pthread_mutex_t *mutex_p;
mutex_p = (pthread_mutex_t *)mutex;
- pthread_mutex_lock(mutex_p);
+ rc = pthread_mutex_lock(mutex_p);
+ OPENSSL_assert(rc == 0);
}
void ossl_crypto_mutex_unlock(CRYPTO_MUTEX *mutex)
{
+ int rc;
pthread_mutex_t *mutex_p;
mutex_p = (pthread_mutex_t *)mutex;
- pthread_mutex_unlock(mutex_p);
+ rc = pthread_mutex_unlock(mutex_p);
+ OPENSSL_assert(rc == 0);
}
void ossl_crypto_mutex_free(CRYPTO_MUTEX **mutex)