aboutsummaryrefslogtreecommitdiff
path: root/src/include/storage/s_lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/storage/s_lock.h')
-rw-r--r--src/include/storage/s_lock.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index dff5ffc8c24..23f4cc9cd4a 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -66,7 +66,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.156 2006/05/19 13:10:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.157 2006/06/07 22:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -784,6 +784,24 @@ extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with,
#endif
+#ifdef WIN32_ONLY_COMPILER
+typedef LONG slock_t;
+
+#define HAS_TEST_AND_SET
+#define TAS(lock) (InterlockedCompareExchange(lock, 1, 0))
+
+#define SPIN_DELAY() spin_delay()
+
+static __forceinline void
+spin_delay(void)
+{
+ /* See comment for gcc code. Same code, MASM syntax */
+ __asm rep nop;
+}
+
+#endif
+
+
#endif /* !defined(HAS_TEST_AND_SET) */