mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 02:51:27 +00:00
Move AtomicAdd/AtomicSet to hsUtils.
This commit is contained in:
@ -314,20 +314,3 @@ void CLock::LeaveWrite () {
|
||||
|
||||
LeaveSpinLock(&m_spinLock);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Exported functions
|
||||
*
|
||||
***/
|
||||
|
||||
//===========================================================================
|
||||
long AtomicAdd (long * value, long increment) {
|
||||
return InterlockedExchangeAdd(value, increment);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
long AtomicSet (long * value, long set) {
|
||||
return InterlockedExchange(value, set);
|
||||
}
|
||||
|
@ -50,26 +50,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "Pch.h"
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Atomic operations
|
||||
*
|
||||
***/
|
||||
|
||||
// *value += increment; return original value of *value; thread safe
|
||||
long AtomicAdd (long * value, long increment);
|
||||
|
||||
// *value = value; return original value of *value; thread safe
|
||||
long AtomicSet (long * value, long set);
|
||||
|
||||
|
||||
#define ATOMIC_ONCE(code) { \
|
||||
static long s_count = 1; \
|
||||
if (AtomicSet(&s_count, 0)) \
|
||||
code; \
|
||||
} //
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* CLock
|
||||
|
Reference in New Issue
Block a user