Go to the documentation of this file.00001 #ifndef HEADER_CURL_THREADS_H
00002 #define HEADER_CURL_THREADS_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "curl_setup.h"
00025
00026 #if defined(USE_THREADS_POSIX)
00027 # define CURL_STDCALL
00028 # define curl_mutex_t pthread_mutex_t
00029 # define curl_thread_t pthread_t *
00030 # define curl_thread_t_null (pthread_t *)0
00031 # define Curl_mutex_init(m) pthread_mutex_init(m, NULL)
00032 # define Curl_mutex_acquire(m) pthread_mutex_lock(m)
00033 # define Curl_mutex_release(m) pthread_mutex_unlock(m)
00034 # define Curl_mutex_destroy(m) pthread_mutex_destroy(m)
00035 #elif defined(USE_THREADS_WIN32)
00036 # define CURL_STDCALL __stdcall
00037 # define curl_mutex_t CRITICAL_SECTION
00038 # define curl_thread_t HANDLE
00039 # define curl_thread_t_null (HANDLE)0
00040 # if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
00041 (_WIN32_WINNT < _WIN32_WINNT_VISTA)
00042 # define Curl_mutex_init(m) InitializeCriticalSection(m)
00043 # else
00044 # define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)
00045 # endif
00046 # define Curl_mutex_acquire(m) EnterCriticalSection(m)
00047 # define Curl_mutex_release(m) LeaveCriticalSection(m)
00048 # define Curl_mutex_destroy(m) DeleteCriticalSection(m)
00049 #endif
00050
00051 #if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
00052
00053
00054 curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
00055 void *arg);
00056
00057 void Curl_thread_destroy(curl_thread_t hnd);
00058
00059 int Curl_thread_join(curl_thread_t *hnd);
00060
00061 #endif
00062
00063 #endif