Interlocked

Interlocked class

Provides API for thread-safe operations. This is a static type with no instance services. You should never create instances of it by any means.

class Interlocked

Methods

MethodDescription
static int32_t Add(int32_t&, int32_t)Increases value atomically.
static int64_t Add(int64_t&, int64_t)Increases value atomically.
static std::enable_if<IsSupportedInt<T>, T>::type CompareExchange(T&, T, T)Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected.
static std::enable_if<!IsSupportedInt<T>, T>::type CompareExchange(T&, T, T)Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected. Not implemented.
static int32_t CompareExchange(int32_t&, int32_t, int32_t, bool&)Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected.
static int32_t Decrement(int32_t&)Decrements value atomically.
static int64_t Decrement(int64_t&)Decrements value atomically.
static std::enable_if<IsSupportedInt<T>, T>::type Exchange(T&, T)Exchanges value on variable: stores new value and returns the value variable had immediately before storing.
static std::enable_if<!IsSupportedInt<T>, T>::type Exchange(T&, T)Exchanges value on variable: stores new value and returns the value variable had immediately before storing. Not implemented.
static int32_t ExchangeAdd(int32_t&, int32_t)Increases value atomically via exchange-add procedure.
static int64_t ExchangeAdd(int64_t&, int64_t)Increases value atomically via exchange-add procedure.
static int32_t Increment(int32_t&)Increments value atomically.
static int64_t Increment(int64_t&)Increments value atomically.
static int64_t Read(int64_t&)Returns a 64-bit value, loaded as an atomic operation.

See Also