46#ifdef LASS_UTIL_ATOMIC_HAVE_POOR_MANS_IMPL
48#if LASS_HAVE_LDREX_STREX || LASS_KUSER_HELPER_VERSION >= 2
49# if LASS_HAVE_LDREXB_STREXB && LASS_HAVE_LDREXH_STREXH
50# if LASS_HAVE_LDREXD_STREXD || LASS_KUSER_HELPER_VERSION >= 5
53# warning "[LASS BUILD MSG] Poor man's implementation of 4-byte adjacent CAS (used in TaggedPtr), and all 8-byte atomics. Performance will suffer!"
55# elif LASS_HAVE_LDREXD_STREXD || LASS_KUSER_HELPER_VERSION >= 5
56# warning "[LASS BUILD MSG] Poor man's implementation of 1- and 2-byte atomics (except 2-byte adjacent CAS). All 4- and 8-byte atomics are good."
58# warning "[LASS BUILD MSG] Poor man's implementation of 1-, 2- and 8-byte atomics, and 4-byte adjacent CAS (used in TaggedPtr). Performance will suffer!"
61# warning "[LASS BUILD MSG] Poor man's implementation of ALL atomics using a mutex! performance will SEVERELY suffer!"
64#if LASS_KUSER_HELPER_VERSION >= 2
68 typedef int (kuser_cmpxchg_t)(
int oldval,
int newval,
volatile int *ptr);
69 #define kuser_cmpxchg (*(kuser_cmpxchg_t *)0xffff0fc0)
76 volatile int globalLock = unlocked;
86PoorMansGlobalAtomicLock::PoorMansGlobalAtomicLock()
97 while (kuser_cmpxchg(old, locked, &globalLock));
100PoorMansGlobalAtomicLock::~PoorMansGlobalAtomicLock()
102 LASS_ASSERT(globalLock == locked);
103 kuser_cmpxchg(locked, unlocked, &globalLock);
121 static Mutex* mutex = 0;
129Mutex*
const initializeBeforeMain = globalMutex();
140PoorMansGlobalAtomicLock::PoorMansGlobalAtomicLock()
142 globalMutex()->lock();
145PoorMansGlobalAtomicLock::~PoorMansGlobalAtomicLock()
147 globalMutex()->unlock();
general utility, debug facilities, ...
Library for Assembled Shared Sources.