@@ -47,11 +47,7 @@ def compare_and_set(expected_val, new_val, expected_mark, new_mark)
47
47
48
48
prospect = ImmutableArray [ new_val , new_mark ]
49
49
50
- # If we guarantee internally that `current` will never be a Numeric, we
51
- # can skip a type check in `compare_and_set` and directly call
52
- # `_compare_and_set`. This is possible since we always internally wrap
53
- # the users `value` and `mark` in an ImmutableArray.
54
- @Reference . _compare_and_set current , prospect
50
+ @Reference . compare_and_set current , prospect
55
51
end
56
52
alias_method :compare_and_swap , :compare_and_set
57
53
@@ -119,7 +115,7 @@ def update
119
115
end
120
116
end
121
117
122
- # @!macro [attach] atomic_markable_reference_method_try_update
118
+ # @!macro [attach] atomic_markable_reference_method_try_update!
123
119
#
124
120
# Pass the current value to the given block, replacing it
125
121
# with the block's result. Raise an exception if the update
@@ -133,7 +129,7 @@ def update
133
129
# @return [ImmutableArray] the new value and marked state
134
130
#
135
131
# @raise [Concurrent::ConcurrentUpdateError] if the update fails
136
- def try_update
132
+ def try_update!
137
133
old_val , old_mark = @Reference . get
138
134
new_val , new_mark = yield old_val , old_mark
139
135
@@ -147,7 +143,7 @@ def try_update
147
143
ImmutableArray [ new_val , new_mark ]
148
144
end
149
145
150
- # @!macro [attach] atomic_markable_reference_method_try_update_no_exception
146
+ # @!macro [attach] atomic_markable_reference_method_try_update
151
147
#
152
148
# Pass the current value to the given block, replacing it with the
153
149
# block's result. Simply return nil if update fails.
@@ -159,7 +155,7 @@ def try_update
159
155
#
160
156
# @return [ImmutableArray] the new value and marked state, or nil if
161
157
# the update failed
162
- def try_update_no_exception
158
+ def try_update
163
159
old_val , old_mark = @Reference . get
164
160
new_val , new_mark = yield old_val , old_mark
165
161
0 commit comments