-// === MACROS ===
-typedef volatile int tSpinlock;
-#define IS_LOCKED(lockptr) (!!(*(tSpinlock*)lockptr))
-/**
- * \brief Inter-Process interrupt (does a Yield)
- */
-#define LOCK(lockptr) do {\
- int v=1;\
- while(v) {\
- __ASM__("xchgl %%eax, (%%edi)":"=a"(v):"a"(1),"D"(lockptr));\
- if(v) Threads_Yield();\
- }\
-}while(0)
-/**
- * \brief Tight spinlock (does a HLT)
- */
-#define TIGHTLOCK(lockptr) do{\
- int v=1;\
- while(v) {\
- __ASM__("xchgl %%eax,(%%edi)":"=a"(v):"a"(1),"D"(lockptr));\
- if(v) __ASM__("hlt");\
- }\
-}while(0)
-/**
- * \brief Very Tight spinlock (short inter-cpu lock)
- */
-#define VTIGHTLOCK(lockptr) do{\
- int v=1;\
- while(v)__ASM__("xchgl %%eax,(%%edi)":"=a"(v):"a"(1),"D"(lockptr));\
-}while(0)