mirror of
https://github.com/curl/curl.git
synced 2026-04-18 20:41:41 +03:00
parent
aa9342058f
commit
5c22bd5384
1 changed files with 2 additions and 11 deletions
|
|
@ -44,17 +44,13 @@
|
|||
/* number of thread locks */
|
||||
#define NUMT 2
|
||||
|
||||
/* This array will store all of the mutexes available to Mbedtls. */
|
||||
static MBEDTLS_MUTEX_T *mutex_buf = NULL;
|
||||
/* This array stores the mutexes available to Mbedtls */
|
||||
static MBEDTLS_MUTEX_T mutex_buf[NUMT];
|
||||
|
||||
int Curl_mbedtlsthreadlock_thread_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
mutex_buf = calloc(1, NUMT * sizeof(MBEDTLS_MUTEX_T));
|
||||
if(!mutex_buf)
|
||||
return 0; /* error, no number of threads defined */
|
||||
|
||||
for(i = 0; i < NUMT; i++) {
|
||||
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
|
||||
if(pthread_mutex_init(&mutex_buf[i], NULL))
|
||||
|
|
@ -73,9 +69,6 @@ int Curl_mbedtlsthreadlock_thread_cleanup(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
if(!mutex_buf)
|
||||
return 0; /* error, no threads locks defined */
|
||||
|
||||
for(i = 0; i < NUMT; i++) {
|
||||
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
|
||||
if(pthread_mutex_destroy(&mutex_buf[i]))
|
||||
|
|
@ -85,8 +78,6 @@ int Curl_mbedtlsthreadlock_thread_cleanup(void)
|
|||
return 0; /* CloseHandle failed */
|
||||
#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
|
||||
}
|
||||
free(mutex_buf);
|
||||
mutex_buf = NULL;
|
||||
|
||||
return 1; /* OK */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue