System::Threading::Interlocked Class Reference

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. More...

Static Public Member Functions

static ASPOSECPP_SHARED_API int32_t Increment (int32_t &location)
 Increments value atomically. More...
 
static ASPOSECPP_SHARED_API int64_t Increment (int64_t &location)
 Increments value atomically. More...
 
static ASPOSECPP_SHARED_API int32_t Decrement (int32_t &location)
 Decrements value atomically. More...
 
static ASPOSECPP_SHARED_API int64_t Decrement (int64_t &location)
 Decrements value atomically. More...
 
static ASPOSECPP_SHARED_API int32_t Add (int32_t &location1, int32_t value)
 Increases value atomically. More...
 
static ASPOSECPP_SHARED_API int64_t Add (int64_t &location1, int64_t value)
 Increases value atomically. More...
 
static ASPOSECPP_SHARED_API int32_t ExchangeAdd (int32_t &location1, int32_t value)
 Increases value atomically via exchange-add procedure. More...
 
static ASPOSECPP_SHARED_API int64_t ExchangeAdd (int64_t &location1, int64_t value)
 Increases value atomically via exchange-add procedure. More...
 
template<typename T >
static std::enable_if< IsSupportedInt< T >, T >::type Exchange (T &location1, T value)
 Exchanges value on variable: stores new value and returns the value variable had immediately before storing. More...
 
template<typename T >
static std::enable_if<!IsSupportedInt< T >, T >::type Exchange (T &location1, T value)
 Exchanges value on variable: stores new value and returns the value variable had immediately before storing. Not implemented. More...
 
template<typename T >
static std::enable_if< IsSupportedInt< T >, T >::type CompareExchange (T &location1, T value, T comparand)
 Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected. More...
 
template<typename T >
static std::enable_if<!IsSupportedInt< T >, T >::type CompareExchange (T &location1, T value, T comparand)
 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. More...
 
static ASPOSECPP_SHARED_API int32_t CompareExchange (int32_t &location1, int32_t value, int32_t comparand, bool &succeeded)
 Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected. More...
 

Detailed Description

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.

Member Function Documentation

◆ Add() [1/2]

static ASPOSECPP_SHARED_API int32_t System::Threading::Interlocked::Add ( int32_t &  location1,
int32_t  value 
)
static

Increases value atomically.

Parameters
location1Variable reference to increase.
valueValue to add to location1.
Returns
Value of variable right after it was increased.

◆ Add() [2/2]

static ASPOSECPP_SHARED_API int64_t System::Threading::Interlocked::Add ( int64_t &  location1,
int64_t  value 
)
static

Increases value atomically.

Parameters
location1Variable reference to increase.
valueValue to add to location1.
Returns
Value of variable right after it was increased.

◆ CompareExchange() [1/3]

template<typename T >
static std::enable_if<IsSupportedInt<T>, T>::type System::Threading::Interlocked::CompareExchange ( T &  location1,
value,
comparand 
)
inlinestatic

Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected.

Template Parameters
TVariable type.
Parameters
location1Variable reference to change.
valueValue to store.
comparandValue to compare variable's value to before exchanging.
Returns
Value of variable on operation start regardless whether it was changed or not.

◆ CompareExchange() [2/3]

template<typename T >
static std::enable_if<!IsSupportedInt<T>, T>::type System::Threading::Interlocked::CompareExchange ( T &  location1,
value,
comparand 
)
inlinestatic

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.

Template Parameters
TVariable type.
Parameters
location1Variable reference to change.
valueValue to store.
comparandValue to compare variable's value to before exchanging.
Returns
Value of variable on operation start regardless whether it was changed or not.

◆ CompareExchange() [3/3]

static ASPOSECPP_SHARED_API int32_t System::Threading::Interlocked::CompareExchange ( int32_t &  location1,
int32_t  value,
int32_t  comparand,
bool &  succeeded 
)
static

Compare-exchanges value on variable: checks if variable is equal to specific value and stores the new value only if stored value matches expected.

Parameters
location1Variable reference to change.
valueValue to store.
comparandValue to compare variable's value to before exchanging.
succeededReference to variable which is set to true if exchange took place and to false otherwise.
Returns
Value of variable on operation start regardless whether it was changed or not.

◆ Decrement() [1/2]

static ASPOSECPP_SHARED_API int32_t System::Threading::Interlocked::Decrement ( int32_t &  location)
static

Decrements value atomically.

Parameters
locationVariable reference to decrement.
Returns
Value of variable right after it was decremented.

◆ Decrement() [2/2]

static ASPOSECPP_SHARED_API int64_t System::Threading::Interlocked::Decrement ( int64_t &  location)
static

Decrements value atomically.

Parameters
locationVariable reference to decrement.
Returns
Value of variable right after it was decremented.

◆ Exchange() [1/2]

template<typename T >
static std::enable_if<IsSupportedInt<T>, T>::type System::Threading::Interlocked::Exchange ( T &  location1,
value 
)
inlinestatic

Exchanges value on variable: stores new value and returns the value variable had immediately before storing.

Template Parameters
TVariable type.
Parameters
location1Variable reference to change.
valueValue to store.
Returns
Value of variable right before it was changed.

◆ Exchange() [2/2]

template<typename T >
static std::enable_if<!IsSupportedInt<T>, T>::type System::Threading::Interlocked::Exchange ( T &  location1,
value 
)
inlinestatic

Exchanges value on variable: stores new value and returns the value variable had immediately before storing. Not implemented.

Template Parameters
TVariable type.
Parameters
location1Variable reference to change.
valueValue to store.
Returns
Value of variable right before it was changed.

◆ ExchangeAdd() [1/2]

static ASPOSECPP_SHARED_API int32_t System::Threading::Interlocked::ExchangeAdd ( int32_t &  location1,
int32_t  value 
)
static

Increases value atomically via exchange-add procedure.

Parameters
location1Variable reference to increase.
valueValue to add to location1.
Returns
Value of variable right after it was increased.

◆ ExchangeAdd() [2/2]

static ASPOSECPP_SHARED_API int64_t System::Threading::Interlocked::ExchangeAdd ( int64_t &  location1,
int64_t  value 
)
static

Increases value atomically via exchange-add procedure.

Parameters
location1Variable reference to increase.
valueValue to add to location1.
Returns
Value of variable right after it was increased.

◆ Increment() [1/2]

static ASPOSECPP_SHARED_API int32_t System::Threading::Interlocked::Increment ( int32_t &  location)
static

Increments value atomically.

Parameters
locationVariable reference to increment.
Returns
Value of variable right after it was incremented.

◆ Increment() [2/2]

static ASPOSECPP_SHARED_API int64_t System::Threading::Interlocked::Increment ( int64_t &  location)
static

Increments value atomically.

Parameters
locationVariable reference to increment.
Returns
Value of variable right after it was incremented.