Skip to content

Commit c067cab

Browse files
committed
Fixed Yardoc for Atomic
1 parent a0bc205 commit c067cab

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

lib/concurrent/atomic_reference/mutex_atomic.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@ def initialize(value = nil)
1717

1818
# @!macro [attach] atomic_reference_method_get
1919
#
20-
# Gets the current value.
20+
# Gets the current value.
2121
#
22-
# @return [Object] the current value
22+
# @return [Object] the current value
2323
def get
2424
@mutex.synchronize { @value }
2525
end
2626
alias_method :value, :get
2727

2828
# @!macro [attach] atomic_reference_method_set
2929
#
30-
# Sets to the given value.
30+
# Sets to the given value.
3131
#
32-
# @param [Object] new_value the new value
32+
# @param [Object] new_value the new value
3333
#
34-
# @return [Object] the new value
34+
# @return [Object] the new value
3535
def set(new_value)
3636
@mutex.synchronize { @value = new_value }
3737
end
3838
alias_method :value=, :set
3939

4040
# @!macro [attach] atomic_reference_method_get_and_set
4141
#
42-
# Atomically sets to the given value and returns the old value.
42+
# Atomically sets to the given value and returns the old value.
4343
#
44-
# @param [Object] new_value the new value
44+
# @param [Object] new_value the new value
4545
#
46-
# @return [Object] the old value
46+
# @return [Object] the old value
4747
def get_and_set(new_value)
4848
@mutex.synchronize do
4949
old_value = @value
@@ -55,14 +55,14 @@ def get_and_set(new_value)
5555

5656
# @!macro [attach] atomic_reference_method_compare_and_set
5757
#
58-
# Atomically sets the value to the given updated value if
59-
# the current value == the expected value.
58+
# Atomically sets the value to the given updated value if
59+
# the current value == the expected value.
6060
#
61-
# @param [Object] old_value the expected value
62-
# @param [Object] new_value the new value
61+
# @param [Object] old_value the expected value
62+
# @param [Object] new_value the new value
6363
#
64-
# @return [Boolean] `true` if successful. A `false` return indicates
65-
# that the actual value was not equal to the expected value.
64+
# @return [Boolean] `true` if successful. A `false` return indicates
65+
# that the actual value was not equal to the expected value.
6666
def _compare_and_set(old_value, new_value) #:nodoc:
6767
return false unless @mutex.try_lock
6868
begin

lib/concurrent/atomic_reference/numeric_cas_wrapper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ module Concurrent
44
module AtomicNumericCompareAndSetWrapper
55

66
# @!macro atomic_reference_method_compare_and_set
7-
def compare_and_set(expected, new)
8-
if expected.kind_of? Numeric
7+
def compare_and_set(old_value, new_value)
8+
if old_value.kind_of? Numeric
99
while true
1010
old = get
1111

1212
return false unless old.kind_of? Numeric
1313

14-
return false unless old == expected
14+
return false unless old == old_value
1515

16-
result = _compare_and_set(old, new)
16+
result = _compare_and_set(old, new_value)
1717
return result if result
1818
end
1919
else
20-
_compare_and_set(expected, new)
20+
_compare_and_set(old_value, new_value)
2121
end
2222
end
2323
alias_method :compare_and_swap, :compare_and_set

0 commit comments

Comments
 (0)