Skip to content
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

Switch atomics to refs #374

Merged
merged 1 commit into from
Mar 6, 2020
Merged

Switch atomics to refs #374

merged 1 commit into from
Mar 6, 2020

Conversation

ericphanson
Copy link
Collaborator

@ericphanson ericphanson commented Mar 5, 2020

Thanks to @vtjnash on #multithreading who pointed out the atomics don't do anything, because we aren't using atomic_not! to flip the boolean one, for example. He emphasized that atomics are relations, not objects, and it's the act of flipping the boolean that could be atomic (i.e. so you could get the current value and negate that, and then set that to be the value, all while knowing another thread hasn't changed the value inbetween getting and setting the value).

Here, however, we don't need to get and set together (atomically), we are just setting, so there is no need for an atomic (and it doesn't do anything).

I think we could use locks if we were concerned about multiple threads changing these values at once, but one just shouldn't do that (just choose the settings at the start of the script; doesn't really make sense to change it partway through a multithreaded computation). I don't think there's a problem with multiple threads reading the values at the same time.

This partially reverts #372 (i.e. reverts the atomic stuff, not the DCP warnings).

@ericphanson ericphanson merged commit d40dfa7 into master Mar 6, 2020
@ericphanson ericphanson deleted the rm-atomics branch March 6, 2020 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant