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
33
33
# given (old) value
34
34
# @yieldparam [Object] old_value the starting value of the atomic reference
35
35
#
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
+ #
36
40
# @return [Object] the new value, or nil if update failed
37
41
def try_update
38
42
old_value = get
@@ -53,6 +57,11 @@ def try_update
53
57
# given (old) value
54
58
# @yieldparam [Object] old_value the starting value of the atomic reference
55
59
#
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
+ #
56
65
# @return [Object] the new value
57
66
#
58
67
# @raise [Concurrent::ConcurrentUpdateError] if the update fails
You can’t perform that action at this time.
0 commit comments