Skip to content

Atom #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2015
Merged

Atom #308

merged 1 commit into from
May 25, 2015

Conversation

jdantonio
Copy link
Member

A Ruby implementation of Clojure's Atom. "Atoms provide a way to manage shared, synchronous, independent state."

@jdantonio jdantonio added enhancement Adding features, adding tests, improving documentation. in progress labels May 25, 2015
@jdantonio jdantonio self-assigned this May 25, 2015
@jdantonio jdantonio added this to the 0.9.0 Release milestone May 25, 2015

@value = Concurrent::AtomicReference.new(value)
ns_set_deref_options(opts)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instance variable visibility should be enforced here, otherwise it's unsafe.

jdantonio added a commit that referenced this pull request May 25, 2015
@jdantonio jdantonio merged commit bb4b9b0 into master May 25, 2015
@jdantonio jdantonio deleted the atom branch May 25, 2015 23:41
# @raise [ArgumentError] if the validator is not a `Proc` (when given)
def initialize(value, opts = {})
super()
synchronize{ ns_initialize(value, opts) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be either synchronized but then all later access has to be synchronized too, which is not what you want probably. ensure_ivar_visibility! will ensure visibility but later access synchronization is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding features, adding tests, improving documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants