File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
lib/concurrent/atomic_reference Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ def update
3333 # given (old) value
3434 # @yieldparam [Object] old_value the starting value of the atomic reference
3535 #
36+ # @note This method was altered to avoid raising an exception by default.
37+ # Instead, this method now returns `nil` in case of failure. For more info,
38+ # please see: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
39+ #
3640 # @return [Object] the new value, or nil if update failed
3741 def try_update
3842 old_value = get
@@ -53,6 +57,11 @@ def try_update
5357 # given (old) value
5458 # @yieldparam [Object] old_value the starting value of the atomic reference
5559 #
60+ # @note This behavior mimics the behavior of the original
61+ # `AtomicReference#try_update` API. The reason this was changed was to
62+ # avoid raising exceptions (which are inherently slow) by default. For more
63+ # info: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
64+ #
5665 # @return [Object] the new value
5766 #
5867 # @raise [Concurrent::ConcurrentUpdateError] if the update fails
You can’t perform that action at this time.
0 commit comments