From 39f632d09656d6fcec79e0a887acc3aed9b7e1a4 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 8 Aug 2023 12:51:27 -0700 Subject: [PATCH] Remove lockCount. --- wolfcrypt/src/wc_port.c | 7 +------ wolfssl/wolfcrypt/types.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index c2169ec09..54eb27f25 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -3702,7 +3702,6 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n) if (cond == NULL) return BAD_FUNC_ARG; - cond->lockCount = 1; /* behave as signal, by defaulting to locked */ if (pthread_mutex_init(&cond->mutex, NULL) != 0) return MEMORY_E; if (pthread_cond_init(&cond->cond, NULL) != 0) { @@ -3728,8 +3727,6 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n) return BAD_FUNC_ARG; pthread_mutex_lock(&cond->mutex); - if (cond->lockCount > 0) - cond->lockCount--; pthread_cond_signal(&cond->cond); pthread_mutex_unlock(&cond->mutex); return 0; @@ -3741,9 +3738,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n) return BAD_FUNC_ARG; pthread_mutex_lock(&cond->mutex); - while (cond->lockCount > 0) - pthread_cond_wait(&cond->cond, &cond->mutex); - cond->lockCount++; + pthread_cond_wait(&cond->cond, &cond->mutex); pthread_mutex_unlock(&cond->mutex); return 0; } diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index a46970ecf..3c4294895 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -1388,7 +1388,6 @@ typedef struct w64wrapper { #else #include typedef struct COND_TYPE { - volatile int lockCount; pthread_mutex_t mutex; pthread_cond_t cond; } COND_TYPE;