Skip to content

Commit b461ffc

Browse files
authored
Merge pull request #707 from ianks/safe-atomic-boolean-operations
Ensure memory barriers when setting/getting atomic boolean
2 parents 3c90f82 + b93f433 commit b461ffc

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@ tmtags
2525
.DS_Store
2626
.githubtoken
2727

28-
spec/examples.txt
28+
# Rspec created files
29+
spec/examples.txt
30+
31+
# Compiled files
32+
lib/concurrent_ruby_ext.jar
33+
lib/concurrent/extension.so
34+
lib/concurrent/extension.bundle

ext/concurrent/atomic_boolean.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ VALUE method_atomic_boolean_initialize(int argc, VALUE* argv, VALUE self) {
2121
}
2222

2323
VALUE method_atomic_boolean_value(VALUE self) {
24-
return (VALUE) DATA_PTR(self);
24+
return(ir_get(self));
2525
}
2626

2727
VALUE method_atomic_boolean_value_set(VALUE self, VALUE value) {
2828
VALUE new_value = TRUTHY(value);
29-
DATA_PTR(self) = (void *) new_value;
30-
return(new_value);
29+
return(ir_set(self, new_value));
3130
}
3231

3332
VALUE method_atomic_boolean_true_question(VALUE self) {

0 commit comments

Comments
 (0)