diff options
author | Bruce Momjian <bruce@momjian.us> | 2004-06-19 04:22:17 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2004-06-19 04:22:17 +0000 |
commit | af70d578257735b8a2c44771969e04f8cb2eb217 (patch) | |
tree | 673c9ac80d489b77ee834fcf841ca020a19cebf1 /src/interfaces/libpq/pthread-win32.c | |
parent | 1181ea6a78dabc1c1c126dc8e0f64057b1b26e82 (diff) | |
download | postgresql-af70d578257735b8a2c44771969e04f8cb2eb217.tar.gz postgresql-af70d578257735b8a2c44771969e04f8cb2eb217.zip |
Enable thread safety for win32.mak build of PostgreSQL.
Andreas Pflug
Diffstat (limited to 'src/interfaces/libpq/pthread-win32.c')
-rw-r--r-- | src/interfaces/libpq/pthread-win32.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/interfaces/libpq/pthread-win32.c b/src/interfaces/libpq/pthread-win32.c new file mode 100644 index 00000000000..87546424df0 --- /dev/null +++ b/src/interfaces/libpq/pthread-win32.c @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- +* +* pthread-win32.c +* partial pthread implementation for win32 +* +* Copyright (c) 2004, PostgreSQL Global Development Group +* IDENTIFICATION +* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.1 2004/06/19 04:22:17 momjian Exp $ +* +*------------------------------------------------------------------------- +*/ + + +#include "windows.h" +#include "pthread.h" + +HANDLE pthread_self() +{ + return GetCurrentThread(); +} + +void pthread_setspecific(pthread_key_t key, void *val) +{ +} + +void *pthread_getspecific(pthread_key_t key) +{ + return NULL; +} + +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); +} |