class Concurrent::MutexAtomicFixnum
def compare_and_set(expect, update)
-
(Boolean)
- true if the value was updated else false
Parameters:
-
update
(Fixnum
) -- the new value -
expect
(Fixnum
) -- the expected value
def compare_and_set(expect, update) @mutex.lock if @value == expect @value = update result = true else result = false end @mutex.unlock result end