Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::InterlockedN Namespace Reference

Functions

template<typename TYPE >
__DECL_IMPORT TYPE Increment (TYPE volatile *pnValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Decrement (TYPE volatile *pnValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE ExchangeAdd (TYPE volatile *pnValue, TYPE nValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Exchange (TYPE volatile *pnValue, TYPE nValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE CompareExchange (TYPE volatile *pnValue, TYPE nValue, TYPE lComparand) noexcept
 
template<>
INTER32_t Increment< INTER32_t > (INTER32_t volatile *pnValue) noexcept
 
template<>
INTER32_t Decrement< INTER32_t > (INTER32_t volatile *pnValue) noexcept
 
template<>
INTER32_t ExchangeAdd< INTER32_t > (INTER32_t volatile *pnValue, INTER32_t nValue) noexcept
 
template<>
INTER32_t Exchange< INTER32_t > (INTER32_t volatile *pnValue, INTER32_t nValue) noexcept
 
template<>
INTER32_t CompareExchange< INTER32_t > (INTER32_t volatile *pnValue, INTER32_t nValue, INTER32_t lComparand) noexcept
 
template<>
INT64 Increment< INT64 > (INT64 volatile *pnValue) noexcept
 
template<>
INT64 Decrement< INT64 > (INT64 volatile *pnValue) noexcept
 
template<>
INT64 ExchangeAdd< INT64 > (INT64 volatile *pnValue, INT64 nValue) noexcept
 
template<>
INT64 Exchange< INT64 > (INT64 volatile *pnValue, INT64 nValue) noexcept
 
template<>
INT64 CompareExchange< INT64 > (INT64 volatile *pnValue, INT64 nValue, INT64 lComparand) noexcept
 
template<>
UINT Increment< UINT > (UINT volatile *pnValue) noexcept
 
template<>
UINT Decrement< UINT > (UINT volatile *pnValue) noexcept
 
template<>
UINT ExchangeAdd< UINT > (UINT volatile *pnValue, UINT nValue) noexcept
 
template<>
UINT Exchange< UINT > (UINT volatile *pnValue, UINT nValue) noexcept
 
template<>
UINT CompareExchange< UINT > (UINT volatile *pnValue, UINT nValue, UINT lComparand) noexcept
 
template<>
UINT64 Increment< UINT64 > (UINT64 volatile *pnValue) noexcept
 
template<>
UINT64 Decrement< UINT64 > (UINT64 volatile *pnValue) noexcept
 
template<>
UINT64 ExchangeAdd< UINT64 > (UINT64 volatile *pnValue, UINT64 nValue) noexcept
 
template<>
UINT64 Exchange< UINT64 > (UINT64 volatile *pnValue, UINT64 nValue) noexcept
 
template<>
UINT64 CompareExchange< UINT64 > (UINT64 volatile *pnValue, UINT64 nValue, UINT64 lComparand) noexcept
 

Detailed Description

namespace for interlock templates for int 32 and 64 Protected unitary operations that are safe on multi threaded/processor machines. INT32 for 32 bit, INT64 for 64 bit.

Note
unitary (single instruction) ops like ++ are NOT SAFE on multi CPU systems !! Tested in cThread.
The parameters for this function must be aligned on a 32-bit boundary; otherwise, the function will behave unpredictably on multiprocessor x86 systems and any non-x86 systems. See _aligned_malloc.
should use __DECL_ALIGN(X) to make sure we are aligned.

Function Documentation

◆ CompareExchange()

template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::CompareExchange ( TYPE volatile *  pnValue,
TYPE  nValue,
TYPE  lComparand 
)
noexcept

◆ CompareExchange< INT64 >()

template<>
INT64 Gray::InterlockedN::CompareExchange< INT64 > ( INT64 volatile *  pnValue,
INT64  nValue,
INT64  lComparand 
)
inlinenoexcept

◆ CompareExchange< INTER32_t >()

template<>
INTER32_t Gray::InterlockedN::CompareExchange< INTER32_t > ( INTER32_t volatile *  pnValue,
INTER32_t  nValue,
INTER32_t  lComparand 
)
inlinenoexcept

◆ CompareExchange< UINT >()

template<>
UINT Gray::InterlockedN::CompareExchange< UINT > ( UINT volatile *  pnValue,
UINT  nValue,
UINT  lComparand 
)
inlinenoexcept

◆ CompareExchange< UINT64 >()

template<>
UINT64 Gray::InterlockedN::CompareExchange< UINT64 > ( UINT64 volatile *  pnValue,
UINT64  nValue,
UINT64  lComparand 
)
inlinenoexcept

◆ Decrement()

template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::Decrement ( TYPE volatile *  pnValue)
noexcept

◆ Decrement< INT64 >()

template<>
INT64 Gray::InterlockedN::Decrement< INT64 > ( INT64 volatile *  pnValue)
inlinenoexcept

◆ Decrement< INTER32_t >()

template<>
INTER32_t Gray::InterlockedN::Decrement< INTER32_t > ( INTER32_t volatile *  pnValue)
inlinenoexcept

◆ Decrement< UINT >()

template<>
UINT Gray::InterlockedN::Decrement< UINT > ( UINT volatile *  pnValue)
inlinenoexcept

◆ Decrement< UINT64 >()

template<>
UINT64 Gray::InterlockedN::Decrement< UINT64 > ( UINT64 volatile *  pnValue)
inlinenoexcept

◆ Exchange()

template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::Exchange ( TYPE volatile *  pnValue,
TYPE  nValue 
)
noexcept

◆ Exchange< INT64 >()

template<>
INT64 Gray::InterlockedN::Exchange< INT64 > ( INT64 volatile *  pnValue,
INT64  nValue 
)
inlinenoexcept

◆ Exchange< INTER32_t >()

template<>
INTER32_t Gray::InterlockedN::Exchange< INTER32_t > ( INTER32_t volatile *  pnValue,
INTER32_t  nValue 
)
inlinenoexcept

◆ Exchange< UINT >()

template<>
UINT Gray::InterlockedN::Exchange< UINT > ( UINT volatile *  pnValue,
UINT  nValue 
)
inlinenoexcept

◆ Exchange< UINT64 >()

template<>
UINT64 Gray::InterlockedN::Exchange< UINT64 > ( UINT64 volatile *  pnValue,
UINT64  nValue 
)
inlinenoexcept

◆ ExchangeAdd()

template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::ExchangeAdd ( TYPE volatile *  pnValue,
TYPE  nValue 
)
noexcept

◆ ExchangeAdd< INT64 >()

template<>
INT64 Gray::InterlockedN::ExchangeAdd< INT64 > ( INT64 volatile *  pnValue,
INT64  nValue 
)
inlinenoexcept

◆ ExchangeAdd< INTER32_t >()

template<>
INTER32_t Gray::InterlockedN::ExchangeAdd< INTER32_t > ( INTER32_t volatile *  pnValue,
INTER32_t  nValue 
)
inlinenoexcept

◆ ExchangeAdd< UINT >()

template<>
UINT Gray::InterlockedN::ExchangeAdd< UINT > ( UINT volatile *  pnValue,
UINT  nValue 
)
inlinenoexcept

◆ ExchangeAdd< UINT64 >()

template<>
UINT64 Gray::InterlockedN::ExchangeAdd< UINT64 > ( UINT64 volatile *  pnValue,
UINT64  nValue 
)
inlinenoexcept

◆ Increment()

template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::Increment ( TYPE volatile *  pnValue)
noexcept

◆ Increment< INT64 >()

template<>
INT64 Gray::InterlockedN::Increment< INT64 > ( INT64 volatile *  pnValue)
inlinenoexcept

◆ Increment< INTER32_t >()

template<>
INTER32_t Gray::InterlockedN::Increment< INTER32_t > ( INTER32_t volatile *  pnValue)
inlinenoexcept

◆ Increment< UINT >()

template<>
UINT Gray::InterlockedN::Increment< UINT > ( UINT volatile *  pnValue)
inlinenoexcept

◆ Increment< UINT64 >()

template<>
UINT64 Gray::InterlockedN::Increment< UINT64 > ( UINT64 volatile *  pnValue)
inlinenoexcept