15 #ifndef IMPALA_UTIL_SPINLOCK_H
16 #define IMPALA_UTIL_SPINLOCK_H
41 inline bool try_lock() {
return __sync_bool_compare_and_swap(&
locked_,
false,
true); }
bool locked_
TODO: pad this to be a cache line?
bool try_lock()
Tries to acquire the lock.
void lock()
Acquires the lock, spins until the lock becomes available.
static const int NUM_SPIN_CYCLES