25 #if (defined(USE_POLARSSL) || defined(USE_MBEDTLS)) && \ 26 (defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)) 28 #if defined(USE_THREADS_POSIX) 29 # ifdef HAVE_PTHREAD_H 32 #elif defined(USE_THREADS_WIN32) 33 # ifdef HAVE_PROCESS_H 48 static POLARSSL_MUTEX_T *
mutex_buf = NULL;
50 int Curl_polarsslthreadlock_thread_setup(
void)
60 for(i = 0; i <
NUMT; i++) {
61 ret = pthread_mutex_init(&
mutex_buf[i], NULL);
65 #elif defined(HAVE_PROCESS_H) 66 for(i = 0; i <
NUMT; i++) {
76 int Curl_polarsslthreadlock_thread_cleanup(
void)
85 for(i = 0; i <
NUMT; i++) {
86 ret = pthread_mutex_destroy(&
mutex_buf[i]);
90 #elif defined(HAVE_PROCESS_H) 91 for(i = 0; i <
NUMT; i++) {
103 int Curl_polarsslthreadlock_lock_function(
int n)
106 #ifdef HAVE_PTHREAD_H 111 "Error: polarsslthreadlock_lock_function failed\n"));
115 #elif defined(HAVE_PROCESS_H) 117 ret = (WaitForSingleObject(
mutex_buf[n], INFINITE) == WAIT_FAILED?1:0);
120 "Error: polarsslthreadlock_lock_function failed\n"));
128 int Curl_polarsslthreadlock_unlock_function(
int n)
131 #ifdef HAVE_PTHREAD_H 133 ret = pthread_mutex_unlock(&
mutex_buf[n]);
136 "Error: polarsslthreadlock_unlock_function failed\n"));
140 #elif defined(HAVE_PROCESS_H) 145 "Error: polarsslthreadlock_unlock_function failed\n"));
static MUTEX_TYPE * mutex_buf
#define calloc(nbelem, size)