Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit a762883

Browse files
committed
#swap also has 'volatile' semantics
1 parent 0318aa5 commit a762883

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/atomic_reference.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ static VALUE ir_set(VALUE self, VALUE new_value) {
6060
}
6161

6262
static VALUE ir_get_and_set(VALUE self, VALUE new_value) {
63-
VALUE old_value;
64-
old_value = (VALUE) DATA_PTR(self);
65-
DATA_PTR(self) = (void *) new_value;
63+
VALUE old_value = ir_get(self);
64+
ir_set(self, new_value);
6665
return old_value;
6766
}
6867

0 commit comments

Comments
 (0)