diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-06 01:44:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-06 01:44:03 +0000 |
commit | ec10c033a7f6ba4819b7a65eb31eba432028f28a (patch) | |
tree | d46a845820f797fae3eed46958c6dee3ba6ed3a6 /node.c | |
parent | ff7eb4c656b0d7629ff00366878fed5fbf86eb93 (diff) | |
download | ruby-ec10c033a7f6ba4819b7a65eb31eba432028f28a.tar.gz |
ruby_atomic.h: atomic VALUE operations
* ruby_atomic.h (ATOMIC_VALUE_EXCHANGE, ATOMIC_VALUE_CAS): add
atomic operations for VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1090,11 +1090,9 @@ rb_alloc_tmp_buffer(volatile VALUE *store, long len) void rb_free_tmp_buffer(volatile VALUE *store) { - VALUE s = *store; - *store = 0; + VALUE s = ATOMIC_VALUE_EXCHANGE(*store, 0); if (s) { - void *ptr = RNODE(s)->u1.node; - RNODE(s)->u1.node = 0; + void *ptr = ATOMIC_PTR_EXCHANGE(RNODE(s)->u1.node, 0); RNODE(s)->u3.cnt = 0; xfree(ptr); } |