An object reference that may be updated atomically. All read and write operations have java volatile semantic.
Thread-safe Variable ClassesEach of the thread-safe variable classes is designed to solve a different problem. In general:
Atomically sets the value to the given updated value if the current value == the expected value.
Gets the current value.
Atomically sets to the given value and returns the old value.
Sets to the given value.
Short string representation.
Pass the current value to the given block, replacing it with the block's result.
Pass the current value to the given block, replacing it with the block's result.
Pass the current value to the given block, replacing it with the block's result.
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s endInstance Method Details #compare_and_set(old_value, new_value) ⇒ Boolean
Atomically sets the value to the given updated value if the current value == the expected value.
that the actual value was not equal to the expected value.
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end#get ⇒ Object
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end#get_and_set(new_value) ⇒ Object
Atomically sets to the given value and returns the old value.
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end#set(new_value) ⇒ Object
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end#to_s ⇒ String Also known as: inspect
Returns Short string representation.
129 130 131
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 129 def to_s format '%s value:%s>', super[0..-2], get end#try_update {|Object| ... } ⇒ Object
Pass the current value to the given block, replacing it with the block's result. Return nil if the update fails.
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end#try_update! {|Object| ... } ⇒ Object
Pass the current value to the given block, replacing it with the block's result. Raise an exception if the update fails.
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end#update {|Object| ... } ⇒ Object
Pass the current value to the given block, replacing it with the block's result. May retry if the value changes during the block's execution.
126 127 128 129 130 131 132 133 134
# File 'lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb', line 126 class AtomicReference < AtomicReferenceImplementation def to_s format '%s value:%s>', super[0..-2], get end alias_method :inspect, :to_s end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4