Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cInterlockedVal.h File Reference
#include "Index.h"
#include "cUnitTestDecl.h"

Go to the source code of this file.

Classes

struct  Gray::__synch_xchg_INT32
 
class  Gray::cInterlockedVal< TYPE >
 
class  Gray::cInterlockedInc
 

Namespaces

 Gray
 < The main namespace for all Core functions.
 
 Gray::InterlockedN
 

Macros

#define _SIZEOF_INT   4
 
#define _SIZEOF_LONG   4
 
#define __synch_xg(x)   ((struct __synch_xchg_INT32 *)(x))
 
#define INTERLOCK_REMAP(T, TI)
 

Typedefs

typedef INT32 Gray::INTER32_t
 Interlock intrinsic type as INT32. More...
 

Functions

INT32 __cdecl Gray::InterlockedCompareExchange (INT32 volatile *pDest, INT32 nValNew, INT32 nValComp) noexcept
 
bool Gray::InterlockedSetIfEqual (_Inout_ INT32 volatile *pDest, INT32 nValNew, INT32 nValComp) noexcept
 
INT32 __cdecl Gray::InterlockedIncrement (INT32 volatile *pDest) noexcept
 
INT32 __cdecl Gray::InterlockedDecrement (INT32 volatile *pDest) noexcept
 
INT32 __cdecl Gray::InterlockedExchange (INT32 volatile *pDest, INT32 Value) noexcept
 
INT32 __cdecl Gray::InterlockedExchangeAdd (INT32 volatile *pDest, INT32 Value) noexcept
 
INT64 __cdecl Gray::_InterlockedCompareExchange64 (_Inout_ INT64 volatile *pDest, IN INT64 nValNew, IN INT64 nValComp) noexcept
 
bool Gray::_InterlockedSetIfEqual64 (_Inout_ INT64 volatile *pDest, INT64 nValNew, INT64 nValComp) noexcept
 
INT64 __cdecl Gray::_InterlockedIncrement64 (_Inout_ INT64 volatile *pDest) noexcept
 
INT64 __cdecl Gray::_InterlockedDecrement64 (_Inout_ INT64 volatile *pDest) noexcept
 
INT64 __cdecl Gray::_InterlockedExchange64 (_Inout_ INT64 volatile *pDest, IN INT64 Value) noexcept
 
INT64 __cdecl Gray::_InterlockedExchangeAdd64 (_Inout_ INT64 volatile *pDest, IN INT64 Value) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::Increment (TYPE volatile *pnValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::Decrement (TYPE volatile *pnValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::ExchangeAdd (TYPE volatile *pnValue, TYPE nValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::Exchange (TYPE volatile *pnValue, TYPE nValue) noexcept
 
template<typename TYPE >
__DECL_IMPORT TYPE Gray::InterlockedN::CompareExchange (TYPE volatile *pnValue, TYPE nValue, TYPE lComparand) noexcept
 
template<>
INTER32_t Gray::InterlockedN::Increment< INTER32_t > (INTER32_t volatile *pnValue) noexcept
 
template<>
INTER32_t Gray::InterlockedN::Decrement< INTER32_t > (INTER32_t volatile *pnValue) noexcept
 
template<>
INTER32_t Gray::InterlockedN::ExchangeAdd< INTER32_t > (INTER32_t volatile *pnValue, INTER32_t nValue) noexcept
 
template<>
INTER32_t Gray::InterlockedN::Exchange< INTER32_t > (INTER32_t volatile *pnValue, INTER32_t nValue) noexcept
 
template<>
INTER32_t Gray::InterlockedN::CompareExchange< INTER32_t > (INTER32_t volatile *pnValue, INTER32_t nValue, INTER32_t lComparand) noexcept
 
template<>
INT64 Gray::InterlockedN::Increment< INT64 > (INT64 volatile *pnValue) noexcept
 
template<>
INT64 Gray::InterlockedN::Decrement< INT64 > (INT64 volatile *pnValue) noexcept
 
template<>
INT64 Gray::InterlockedN::ExchangeAdd< INT64 > (INT64 volatile *pnValue, INT64 nValue) noexcept
 
template<>
INT64 Gray::InterlockedN::Exchange< INT64 > (INT64 volatile *pnValue, INT64 nValue) noexcept
 
template<>
INT64 Gray::InterlockedN::CompareExchange< INT64 > (INT64 volatile *pnValue, INT64 nValue, INT64 lComparand) noexcept
 
template<>
UINT Gray::InterlockedN::Increment< UINT > (UINT volatile *pnValue) noexcept
 
template<>
UINT Gray::InterlockedN::Decrement< UINT > (UINT volatile *pnValue) noexcept
 
template<>
UINT Gray::InterlockedN::ExchangeAdd< UINT > (UINT volatile *pnValue, UINT nValue) noexcept
 
template<>
UINT Gray::InterlockedN::Exchange< UINT > (UINT volatile *pnValue, UINT nValue) noexcept
 
template<>
UINT Gray::InterlockedN::CompareExchange< UINT > (UINT volatile *pnValue, UINT nValue, UINT lComparand) noexcept
 
template<>
UINT64 Gray::InterlockedN::Increment< UINT64 > (UINT64 volatile *pnValue) noexcept
 
template<>
UINT64 Gray::InterlockedN::Decrement< UINT64 > (UINT64 volatile *pnValue) noexcept
 
template<>
UINT64 Gray::InterlockedN::ExchangeAdd< UINT64 > (UINT64 volatile *pnValue, UINT64 nValue) noexcept
 
template<>
UINT64 Gray::InterlockedN::Exchange< UINT64 > (UINT64 volatile *pnValue, UINT64 nValue) noexcept
 
template<>
UINT64 Gray::InterlockedN::CompareExchange< UINT64 > (UINT64 volatile *pnValue, UINT64 nValue, UINT64 lComparand) noexcept
 
typedef Gray::__DECL_ALIGN (4) cInterlockedVal< INT32 > cInterlockedInt32
 
typedef Gray::__DECL_ALIGN (8) cInterlockedVal< INT64 > cInterlockedInt64
 

Variables

template<typename TYPE = void>
class __DECL_IMPORT __DECL_ALIGN(4) cInterlockedPtr typedef cInterlockedPtr Gray::cInterlockedPtrV
 
template class __DECL_IMPORT Gray::cInterlockedPtr< >
 
template class __DECL_IMPORT Gray::cInterlockedVal< long >
 
template class __DECL_IMPORT Gray::cInterlockedVal< ULONG >
 

Detailed Description

single values that are safe to change on multiple threads.

Macro Definition Documentation

◆ __synch_xg

#define __synch_xg (   x)    ((struct __synch_xchg_INT32 *)(x))

◆ _SIZEOF_INT

#define _SIZEOF_INT   4

◆ _SIZEOF_LONG

#define _SIZEOF_LONG   4

bytes in long or unsigned long for __DECL_ALIGN macro. Use if we can't do sizeof(x)

◆ INTERLOCK_REMAP

#define INTERLOCK_REMAP (   T,
  TI 
)
Value:
template<> inline T Increment<T>( T VOLATILE* pnValue ) noexcept \
{ return (T) Increment<TI>( (TI VOLATILE*) pnValue); } \
template<> inline T Decrement<T>( T VOLATILE* pnValue ) noexcept \
{ return (T) Decrement<TI>( (TI VOLATILE*) pnValue); } \
template<> inline T ExchangeAdd<T>( T VOLATILE* pnValue, T nValue ) noexcept \
{ return (T) ExchangeAdd<TI>( (TI VOLATILE*) pnValue, (TI) nValue ); } \
template<> inline T Exchange<T>( T VOLATILE* pnValue, T nValue ) noexcept \
{ return (T) Exchange<TI>( (TI VOLATILE*) pnValue,(TI)nValue); } \
template<> inline T CompareExchange<T>( T VOLATILE* pnValue, T nValue, T lComparand ) noexcept \
{ return (T) CompareExchange<TI>( (TI VOLATILE*) pnValue, (TI)nValue, (TI)lComparand); }
#define VOLATILE
Definition: SysTypes.h:429