lib/garcon/task/atomic.rb
# Atomically sets the value to the given updated value if the current value
# is equal the expected value.
#
# @param [Object] old_value
#   The expected value.
# @param [Object] new_value
#   The new value.
#
# @return [Boolean]
#   `true` if successful, `false` indicates that the actual value was not
#   equal to the expected value.
Atomically sets the value to the given updated value if the current value
is equal the expected value.
Atomically sets the value to the given updated value if the current value is equal the expected value .
def _compare_and_set(old_value, new_value)
      return false unless @mutex.try_lock
      begin
        return false unless @value.equal? old_value
        @value = new_value
      ensure
        @mutex.unlock
      end
      true
    end
def _compare_and_set ( old_value , new_value ) return false unless @mutex . try_lock begin return false unless @value . equal? old_value @value = new_value ensure @mutex . unlock end true end
Atomically sets the value to the given updated value if the current value
is equal the expected value.
Atomically sets the value to the given updated value if the current value is equal the expected value .
`true` if successful, `false` indicates that the actual value was not equal to the expected value.
` true ` if successful ` false ` indicates that the actual value was not equal to the expected value .
Boolean
old_value
<not_specific>
new_value
<not_specific>
<not_specific>
new_value The new value.
new_value The new value .