2011-08-26 16:08:29 +02:00
|
|
|
// Mutual exclusion lock for short code fragments
|
2006-07-12 11:10:25 +02:00
|
|
|
struct spinlock {
|
2009-08-31 08:02:08 +02:00
|
|
|
uint locked; // Is the lock held?
|
2006-09-07 16:12:30 +02:00
|
|
|
|
|
|
|
// For debugging:
|
2009-08-31 08:02:08 +02:00
|
|
|
char *name; // Name of lock.
|
|
|
|
struct cpu *cpu; // The cpu holding the lock.
|
|
|
|
uint pcs[10]; // The call stack (an array of program counters)
|
|
|
|
// that locked the lock.
|
2006-07-12 11:10:25 +02:00
|
|
|
};
|
2007-08-28 07:00:39 +02:00
|
|
|
|
2011-08-26 16:08:29 +02:00
|
|
|
// Lock that maybe held across sleeps
|
|
|
|
struct sleeplock {
|
|
|
|
uint locked; // Is the lock held?
|
|
|
|
};
|
|
|
|
|