Index: src/port/pthread-win32.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/port/pthread-win32.h,v retrieving revision 1.2 diff -c -r1.2 pthread-win32.h *** src/port/pthread-win32.h 18 Apr 2007 08:32:40 -0000 1.2 --- src/port/pthread-win32.h 11 Apr 2008 18:35:33 -0000 *************** *** 2,8 **** #define __PTHREAD_H typedef ULONG pthread_key_t; ! typedef HANDLE pthread_mutex_t; typedef int pthread_once_t; DWORD pthread_self(void); --- 2,8 ---- #define __PTHREAD_H typedef ULONG pthread_key_t; ! typedef CRITICAL_SECTION *pthread_mutex_t; typedef int pthread_once_t; DWORD pthread_self(void); Index: src/interfaces/libpq/pthread-win32.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/pthread-win32.c,v retrieving revision 1.15 diff -c -r1.15 pthread-win32.c *** src/interfaces/libpq/pthread-win32.c 1 Jan 2008 19:46:00 -0000 1.15 --- src/interfaces/libpq/pthread-win32.c 11 Apr 2008 18:35:33 -0000 *************** *** 35,51 **** void pthread_mutex_init(pthread_mutex_t *mp, void *attr) { ! *mp = CreateMutex(0, 0, 0); } void pthread_mutex_lock(pthread_mutex_t *mp) { ! WaitForSingleObject(*mp, INFINITE); } void pthread_mutex_unlock(pthread_mutex_t *mp) { ! ReleaseMutex(*mp); } --- 35,69 ---- void pthread_mutex_init(pthread_mutex_t *mp, void *attr) { ! if(mp) ! { ! *mp = (CRITICAL_SECTION *)malloc(sizeof(CRITICAL_SECTION)); ! if(*mp) ! InitializeCriticalSection(*mp); ! } } void pthread_mutex_lock(pthread_mutex_t *mp) { ! if(mp && *mp) ! EnterCriticalSection(*mp); } void pthread_mutex_unlock(pthread_mutex_t *mp) { ! if(mp && *mp) ! LeaveCriticalSection(*mp); } + + /* If ever needed + pthread_mutex_destroy(pthread_mutex_t *mp) + { + if(mp && *mp) + { + DeleteCriticalSection(*mp); + *mp = NULL; + } + } + */ \ No newline at end of file