Skip to content

Commit

Permalink
Merge pull request #707 from ianks/safe-atomic-boolean-operations
Browse files Browse the repository at this point in the history
Ensure memory barriers when setting/getting atomic boolean
  • Loading branch information
pitr-ch committed May 7, 2018
2 parents 3c90f82 + b93f433 commit b461ffc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Expand Up @@ -25,4 +25,10 @@ tmtags
.DS_Store
.githubtoken

spec/examples.txt
# Rspec created files
spec/examples.txt

# Compiled files
lib/concurrent_ruby_ext.jar
lib/concurrent/extension.so
lib/concurrent/extension.bundle
5 changes: 2 additions & 3 deletions ext/concurrent/atomic_boolean.c
Expand Up @@ -21,13 +21,12 @@ VALUE method_atomic_boolean_initialize(int argc, VALUE* argv, VALUE self) {
}

VALUE method_atomic_boolean_value(VALUE self) {
return (VALUE) DATA_PTR(self);
return(ir_get(self));
}

VALUE method_atomic_boolean_value_set(VALUE self, VALUE value) {
VALUE new_value = TRUTHY(value);
DATA_PTR(self) = (void *) new_value;
return(new_value);
return(ir_set(self, new_value));
}

VALUE method_atomic_boolean_true_question(VALUE self) {
Expand Down

0 comments on commit b461ffc

Please sign in to comment.