@@ -17,33 +17,33 @@ def initialize(value = nil)
17
17
18
18
# @!macro [attach] atomic_reference_method_get
19
19
#
20
- # Gets the current value.
20
+ # Gets the current value.
21
21
#
22
- # @return [Object] the current value
22
+ # @return [Object] the current value
23
23
def get
24
24
@mutex . synchronize { @value }
25
25
end
26
26
alias_method :value , :get
27
27
28
28
# @!macro [attach] atomic_reference_method_set
29
29
#
30
- # Sets to the given value.
30
+ # Sets to the given value.
31
31
#
32
- # @param [Object] new_value the new value
32
+ # @param [Object] new_value the new value
33
33
#
34
- # @return [Object] the new value
34
+ # @return [Object] the new value
35
35
def set ( new_value )
36
36
@mutex . synchronize { @value = new_value }
37
37
end
38
38
alias_method :value= , :set
39
39
40
40
# @!macro [attach] atomic_reference_method_get_and_set
41
41
#
42
- # Atomically sets to the given value and returns the old value.
42
+ # Atomically sets to the given value and returns the old value.
43
43
#
44
- # @param [Object] new_value the new value
44
+ # @param [Object] new_value the new value
45
45
#
46
- # @return [Object] the old value
46
+ # @return [Object] the old value
47
47
def get_and_set ( new_value )
48
48
@mutex . synchronize do
49
49
old_value = @value
@@ -55,14 +55,14 @@ def get_and_set(new_value)
55
55
56
56
# @!macro [attach] atomic_reference_method_compare_and_set
57
57
#
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.
60
60
#
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
63
63
#
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.
66
66
def _compare_and_set ( old_value , new_value ) #:nodoc:
67
67
return false unless @mutex . try_lock
68
68
begin
0 commit comments