blob: cb2dabdbffaf8c3ebc6b8b6056e15a0da4270be8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
//#define CAS_LOCK_USLEEP 4
#define CAS_LOCK_USLEEP 200
static inline void lock(volatile int *aexclusion) {
while (__sync_lock_test_and_set(aexclusion, 1))
while (*aexclusion)
usleep(CAS_LOCK_USLEEP);
}
static inline void unlock(volatile int *aexclusion) {
__sync_lock_release(aexclusion);
}
|