// @return: the result
inline Atomic32 AtomicRecCountIncN(volatile Atomic32 & out_atomic32Des,
Atomic32 in_atomic32Increment)
{
return ::InterlockedExchangeAdd(reinterpret_cast<volatile LONG*>(&out_atomic32Des),
in_atomic32Increment) + in_atomic32Increment;
}
// @return: the result
inline Atomic32 AtomicRecCountDecN(volatile Atomic32 & out_atomic32Des,
Atomic32 in_atomic32Increment)
{
return ::InterlockedExchangeAdd(reinterpret_cast<volatile LONG*>(&out_atomic32Des),
-in_atomic32Increment) - in_atomic32Increment;
}
// @return: the result
inline bool AtomicRecCountCompare(volatile Atomic32 & atomic32Src,
Atomic32 atomic32Des)
{
// to make the == operator atomic
// in this way the current atomic32Src's value is in atomic32Tem,
// and it's thread safe !
Atomic32 atomic32Tem = atomic32Src;