mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
ff7eb4c656
commit
ec10c033a7
5 changed files with 76 additions and 12 deletions
6
node.c
6
node.c
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue