Newer
Older
#include "types.h"
#include "defs.h"
#include "x86.h"
#include "param.h"
#include "proc.h"
#include "spinlock.h"
// Can't call cprintf from inside these routines,
// because cprintf uses them itself.
{
if(holding(lock)){
extern use_console_lock;
use_console_lock = 0;
cprintf("lock %s pc %x\n", lock->name ? lock->name : "", lock->pc);
if(cpus[cpu()].nlock++ == 0)
cli();
while(cmpxchg(0, 1, &lock->locked) == 1)
;
cpuid(0, 0, 0, 0, 0); // memory barrier
}
void
{