I\'m new to using gcc inline assembly, and was wondering if, on an x86 multi-core machine, a spinlock (without race conditions) could be implemented as (using AT&T synta
This will put less contention on the memory bus:
void spin_lock(int *p) { while(!__sync_bool_compare_and_swap(p, 0, 1)) while(*p); }