Usage

class atomic.AtomicLong(value=None)

An atomic class that guarantees atomic updates to its contained integer value.

compare_and_set(expect_value, new_value)

Atomically sets the value to the given value if the current value is equal to the expected value.

Parameters:
  • expect_value – the expected value
  • new_value – the new value
get_and_set(new_value)

Atomically sets to the given value and returns the old value

Parameters:new_value – the new value
class atomic.AtomicLongArray(array=[])

An atomic class that guarantees atomic updates to its contained integer values.