summaryrefslogtreecommitdiff
path: root/ruby_atomic.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-09 06:48:15 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-09 06:48:15 (GMT)
commit0599d7de5844a2f838cdf631b9c88b05010ebe5d (patch)
tree4553ae951239a25b2d8a5bc7325e9d9e096e1e80 /ruby_atomic.h
parente48adae2b3e7dfab79fb5a72467a559749edebd5 (diff)
use atomic operations
* regcomp.c (onig_chain_link_add): use atomic operation instead of mutex. * regint.h (ONIG_STATE_{INC,DEC}_THREAD): ditto. * regparse.c (PopFreeNode, node_recycle): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r--ruby_atomic.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 4bc9f37..52b93ef 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -42,6 +42,7 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
#pragma intrinsic(_InterlockedOr)
#endif
typedef LONG rb_atomic_t;
+#define SIZEOF_ATOMIC_T SIZEOF_LONG
# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
# define ATOMIC_INC(var) InterlockedIncrement(&(var))
@@ -143,6 +144,10 @@ ruby_atomic_size_exchange(size_t *ptr, size_t val)
}
#endif
+#ifndef SIZEOF_ATOMIC_T
+#define SIZEOF_ATOMIC_T SIZEOF_INT
+#endif
+
#ifndef ATOMIC_SIZE_INC
# define ATOMIC_SIZE_INC(var) ATOMIC_INC(var)
#endif