1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-12-09 06:48:15 +00:00
parent e48adae2b3
commit 0599d7de58
6 changed files with 80 additions and 50 deletions

View file

@ -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