-
Notifications
You must be signed in to change notification settings - Fork 417
Deprecated Concurrent::Atomic in lieu of Concurrent::AtomicReference. #277
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| require 'concurrent/native_extensions' | ||
| require 'concurrent/utility/engine' | ||
| require 'concurrent/atomic_reference/concurrent_update_error' | ||
| require 'concurrent/atomic_reference/mutex_atomic' | ||
|
|
||
| begin | ||
| # force fallback impl with FORCE_ATOMIC_FALLBACK=1 | ||
| if /[^0fF]/ =~ ENV['FORCE_ATOMIC_FALLBACK'] | ||
| ruby_engine = 'mutex_atomic' | ||
| else | ||
| ruby_engine = Concurrent.ruby_engine | ||
| end | ||
|
|
||
| require "concurrent/atomic_reference/#{ruby_engine}" | ||
| rescue LoadError | ||
| #warn 'Compiled extensions not installed, pure Ruby Atomic will be used.' | ||
| end | ||
|
|
||
| if defined? Concurrent::JavaAtomicReference | ||
|
|
||
| # @!macro atomic_reference | ||
| class Concurrent::AtomicReference < Concurrent::JavaAtomicReference | ||
| end | ||
|
|
||
| elsif defined? Concurrent::RbxAtomicReference | ||
|
|
||
| # @!macro atomic_reference | ||
| class Concurrent::AtomicReference < Concurrent::RbxAtomicReference | ||
| end | ||
|
|
||
| elsif defined? Concurrent::CAtomicReference | ||
|
|
||
| # @!macro atomic_reference | ||
| class Concurrent::AtomicReference < Concurrent::CAtomicReference | ||
| end | ||
|
|
||
| else | ||
|
|
||
| # @!macro atomic_reference | ||
| class Concurrent::AtomicReference < Concurrent::MutexAtomicReference | ||
| end | ||
| end | ||
|
|
||
| module Concurrent | ||
|
|
||
| # @see Concurrent::AtomicReference | ||
| # @deprecated Use Concurrent::AtomicReference instead. | ||
| Atomic = AtomicReference | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| require 'concurrent/atomic' | ||
|
|
||
| module Concurrent | ||
|
|
||
| # @!macro [attach] abstract_thread_local_var | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,43 @@ | ||
| require 'concurrent/atomic' | ||
| # @!macro [new] atomic_reference | ||
| # | ||
| # An object reference that may be updated atomically. | ||
| # | ||
| # Testing with ruby 2.1.2 | ||
| # | ||
| # *** Sequential updates *** | ||
| # user system total real | ||
| # no lock 0.000000 0.000000 0.000000 ( 0.005502) | ||
| # mutex 0.030000 0.000000 0.030000 ( 0.025158) | ||
| # MutexAtomicReference 0.100000 0.000000 0.100000 ( 0.103096) | ||
| # CAtomicReference 0.040000 0.000000 0.040000 ( 0.034012) | ||
| # | ||
| # *** Parallel updates *** | ||
| # user system total real | ||
| # no lock 0.010000 0.000000 0.010000 ( 0.009387) | ||
| # mutex 0.030000 0.010000 0.040000 ( 0.032545) | ||
| # MutexAtomicReference 0.830000 2.280000 3.110000 ( 2.146622) | ||
| # CAtomicReference 0.040000 0.000000 0.040000 ( 0.038332) | ||
| # | ||
| # Testing with jruby 1.9.3 | ||
| # | ||
| # *** Sequential updates *** | ||
| # user system total real | ||
| # no lock 0.170000 0.000000 0.170000 ( 0.051000) | ||
| # mutex 0.370000 0.010000 0.380000 ( 0.121000) | ||
| # MutexAtomicReference 1.530000 0.020000 1.550000 ( 0.471000) | ||
| # JavaAtomicReference 0.370000 0.010000 0.380000 ( 0.112000) | ||
| # | ||
| # *** Parallel updates *** | ||
| # user system total real | ||
| # no lock 0.390000 0.000000 0.390000 ( 0.105000) | ||
| # mutex 0.480000 0.040000 0.520000 ( 0.145000) | ||
| # MutexAtomicReference 1.600000 0.180000 1.780000 ( 0.511000) | ||
| # JavaAtomicReference 0.460000 0.010000 0.470000 ( 0.131000) | ||
| # | ||
| # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html | ||
| # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html | ||
|
|
||
| require 'concurrent/atomic/atomic_reference' | ||
| require 'concurrent/atomic/atomic_boolean' | ||
| require 'concurrent/atomic/atomic_fixnum' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move 'atomic_reference' -> 'atomic/atomic_reference'?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| require 'concurrent/atomic/condition' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant something like:
So it is actually the same class, because having two classes with same behavior but not-identical may be causing problems in comparisons when both names are used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I've tried to do that in the past yardoc wouldn't generate documentation for the 'alias' class. That's the main reason I did the subclass. What you say makes sense, though. I'll make the change and then figure out some way to get reasonable documentation in yardoc.