2011-08-26 14:08:29 +00:00
|
|
|
// Mutual exclusion lock for short code fragments
|
2006-07-12 09:10:25 +00:00
|
|
|
struct spinlock {
|
2009-08-31 06:02:08 +00:00
|
|
|
uint locked; // Is the lock held?
|
2006-09-07 14:12:30 +00:00
|
|
|
|
|
|
|
// For debugging:
|
2009-08-31 06:02:08 +00: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 09:10:25 +00:00
|
|
|
};
|
2007-08-28 05:00:39 +00:00
|
|
|
|
2011-08-26 14:08:29 +00:00
|
|
|
// Lock that maybe held across sleeps
|
|
|
|
struct sleeplock {
|
|
|
|
uint locked; // Is the lock held?
|
|
|
|
};
|
|
|
|
|