mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Remove lockCount.
This commit is contained in:
@@ -3702,7 +3702,6 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
|
|||||||
if (cond == NULL)
|
if (cond == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
cond->lockCount = 1; /* behave as signal, by defaulting to locked */
|
|
||||||
if (pthread_mutex_init(&cond->mutex, NULL) != 0)
|
if (pthread_mutex_init(&cond->mutex, NULL) != 0)
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
if (pthread_cond_init(&cond->cond, NULL) != 0) {
|
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;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
pthread_mutex_lock(&cond->mutex);
|
pthread_mutex_lock(&cond->mutex);
|
||||||
if (cond->lockCount > 0)
|
|
||||||
cond->lockCount--;
|
|
||||||
pthread_cond_signal(&cond->cond);
|
pthread_cond_signal(&cond->cond);
|
||||||
pthread_mutex_unlock(&cond->mutex);
|
pthread_mutex_unlock(&cond->mutex);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3741,9 +3738,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
|
|||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
pthread_mutex_lock(&cond->mutex);
|
pthread_mutex_lock(&cond->mutex);
|
||||||
while (cond->lockCount > 0)
|
|
||||||
pthread_cond_wait(&cond->cond, &cond->mutex);
|
pthread_cond_wait(&cond->cond, &cond->mutex);
|
||||||
cond->lockCount++;
|
|
||||||
pthread_mutex_unlock(&cond->mutex);
|
pthread_mutex_unlock(&cond->mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1388,7 +1388,6 @@ typedef struct w64wrapper {
|
|||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
typedef struct COND_TYPE {
|
typedef struct COND_TYPE {
|
||||||
volatile int lockCount;
|
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
pthread_cond_t cond;
|
pthread_cond_t cond;
|
||||||
} COND_TYPE;
|
} COND_TYPE;
|
||||||
|
Reference in New Issue
Block a user