summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/include/ecpg-pthread-win32.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/include/ecpg-pthread-win32.h')
-rw-r--r--src/interfaces/ecpg/include/ecpg-pthread-win32.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/include/ecpg-pthread-win32.h b/src/interfaces/ecpg/include/ecpg-pthread-win32.h
new file mode 100644
index 0000000000..df076ac8e5
--- /dev/null
+++ b/src/interfaces/ecpg/include/ecpg-pthread-win32.h
@@ -0,0 +1,16 @@
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg-pthread-win32.h,v 1.1 2007/03/29 12:02:24 meskes Exp $ */
+/*
+ * pthread mapping macros for win32 native thread implementation
+ */
+#ifndef _ECPG_PTHREAD_WIN32_H
+#define _ECPG_PTHREAD_WIN32_H
+#define pthread_mutex_lock(x) do { \
+ if (*x == INVALID_HANDLE_VALUE) \
+ *x = CreateMutex(NULL, FALSE, NULL); \
+ WaitForSingleObject(*x, INFINITE); \
+} while (0);
+#define pthread_mutex_unlock(x) ReleaseMutex(*x)
+#define pthread_getspecific(x) TlsGetValue(x)
+#define pthread_setspecific(x,y) TlsSetValue(x,y)
+#define pthread_key_create(x,y) *x = TlsAlloc();
+#endif