#ifndef _SPINLOCK_H #define _SPINLOCK_H typedef struct { int ticket[16]; // allow up to 16 CPUs. int choiceInProgress[16]; int deleteInProgress; } spinlock_t; enum spinlock_returns { SPINLOCK_SUCCESS, SPINLOCK_FAIL_DELETING } spinlock_t * spinlockCreate(); void spinlockInit(spinlock_t &); void spinlockDelete(spinlock_t *); int spinlockLock(spinlock_t *, int); int spinlockUnlock(spinlock_t *, int); #endif