5 #ifndef _ECPG_PTHREAD_WIN32_H
6 #define _ECPG_PTHREAD_WIN32_H
8 #ifdef ENABLE_THREAD_SAFETY
24 #define PTHREAD_MUTEX_INITIALIZER { NULL, 0 }
25 #define PTHREAD_ONCE_INIT false
30 #define pthread_mutex_lock(mutex) \
32 if ((mutex)->handle == NULL) \
33 win32_pthread_mutex((mutex)); \
34 WaitForSingleObject((mutex)->handle, INFINITE); \
37 #define pthread_mutex_unlock(mutex) \
38 ReleaseMutex((mutex)->handle)
40 #define pthread_getspecific(key) \
43 #define pthread_setspecific(key, value) \
44 TlsSetValue((key), (value))
47 #define pthread_key_create(key, destructor) \
48 do { *(key) = TlsAlloc(); ((void)(destructor)); } while(0)
50 #define pthread_once(once, fn) \
53 win32_pthread_once((once), (fn)); \
CRITICAL_SECTION * pthread_mutex_t
static void * fn(void *arg)