5 #ifndef _ECPG_PTHREAD_WIN32_H
6 #define _ECPG_PTHREAD_WIN32_H
22 #define PTHREAD_MUTEX_INITIALIZER { NULL, 0 }
23 #define PTHREAD_ONCE_INIT false
28 #define pthread_mutex_lock(mutex) \
30 if ((mutex)->handle == NULL) \
31 win32_pthread_mutex((mutex)); \
32 WaitForSingleObject((mutex)->handle, INFINITE); \
35 #define pthread_mutex_unlock(mutex) \
36 ReleaseMutex((mutex)->handle)
38 #define pthread_getspecific(key) \
41 #define pthread_setspecific(key, value) \
42 TlsSetValue((key), (value))
45 #define pthread_key_create(key, destructor) \
46 do { *(key) = TlsAlloc(); ((void)(destructor)); } while(0)
48 #define pthread_once(once, fn) \
51 win32_pthread_once((once), (fn)); \
CRITICAL_SECTION * pthread_mutex_t
static void * fn(void *arg)