#ifndef TAS_H #define TAS_H /* Simple test-and-set and test-and-test-and-set locks. Ought to be modified to incorporate bounded exponential backoff. */ #include "atomic_ops.h" typedef volatile unsigned long tas_lock; #define tatas_lock tas_lock static __inline__ void tas_acquire(tas_lock *L) { while (tas(L)); } static __inline__ void tatas_acquire(tatas_lock *L) { while (tas(L)) { while(*L); } } static __inline__ void tas_release(tas_lock *L) { *L = 0; } #define tatas_release tas_release #endif