1 #include "include.h" 2 3 void lock(Lock * l)4 lock(Lock* l) 5 { 6 for(;;){ 7 while(l->key) 8 ; 9 if(TAS(&l->key) == 0) 10 return; 11 } 12 } 13 14 void unlock(Lock * l)15 unlock(Lock* l) 16 { 17 l->key = 0; 18 } 19