summaryrefslogtreecommitdiff
path: root/atomic.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-09 07:56:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-09 07:56:04 +0000
commit2a8a9d1def49b2673814e2307520fd02f9d536dd (patch)
tree39f52c1e89e11022d52e2f6e09af47e6ab55de1b /atomic.h
parent03c618daf0f7a0e668e1f4eb25e5aa139bfb5175 (diff)
* atomic.h (ATOMIC_OR): _InterlockedOr is unavailable in VC6.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'atomic.h')
-rw-r--r--atomic.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/atomic.h b/atomic.h
index ad9b339994..5b3fb99024 100644
--- a/atomic.h
+++ b/atomic.h
@@ -2,7 +2,7 @@
#define RUBY_ATOMIC_H
#ifdef _WIN32
-#ifdef _MSC_VER
+#if defined _MSC_VER && _MSC_VER > 1200
#pragma intrinsic(_InterlockedOr)
#endif
typedef LONG rb_atomic_t;
@@ -12,6 +12,19 @@ typedef LONG rb_atomic_t;
# define ATOMIC_DEC(var) InterlockedDecrement(&(var))
#if defined __GNUC__
# define ATOMIC_OR(var, val) __asm__("lock\n\t" "orl\t%1, %0" : "=m"(var) : "Ir"(val))
+#elif defined _MSC_VER && _MSC_VER <= 1200
+# define ATOMIC_OR(var, val) rb_w32_atomic_or(&(var), (val))
+static inline void
+rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
+{
+#ifdef _M_IX86
+ __asm mov eax, var;
+ __asm mov ecx, val;
+ __asm lock or [eax], ecx;
+#else
+#error unsupported architecture
+#endif
+}
#else
# define ATOMIC_OR(var, val) _InterlockedOr(&(var), (val))
#endif