summaryrefslogtreecommitdiff
path: root/atomic.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-12 00:32:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-12 00:32:32 +0000
commitdf3e3768e98b6bc60e8f0297c80ad7d8696e6a1e (patch)
treec6d3c0340d816b951abd62fc53ffe1482eafba99 /atomic.h
parent465b0d49d637850a7a22732e541b06295f430cee (diff)
downloadruby-df3e3768e98b6bc60e8f0297c80ad7d8696e6a1e.tar.gz
* atomic.h (ATOMIC_OR): _InterlockedOr is not available on migw.
* gc.c (rb_gc_set_params): VM_OBJSPACE is disabled on mignw. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'atomic.h')
-rw-r--r--atomic.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/atomic.h b/atomic.h
index dd62b0c9fd..ad9b339994 100644
--- a/atomic.h
+++ b/atomic.h
@@ -2,13 +2,19 @@
#define RUBY_ATOMIC_H
#ifdef _WIN32
+#ifdef _MSC_VER
#pragma intrinsic(_InterlockedOr)
+#endif
typedef LONG rb_atomic_t;
# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
# define ATOMIC_INC(var) InterlockedIncrement(&(var))
# 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))
+#else
# define ATOMIC_OR(var, val) _InterlockedOr(&(var), (val))
+#endif
# define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val))
#elif defined HAVE_GCC_ATOMIC_BUILTINS