xv6-k210/kernel/include/sleeplock.h

25 lines
582 B
C

#ifndef __SLEEPLOCK_H
#define __SLEEPLOCK_H
#include "types.h"
#include "spinlock.h"
struct spinlock;
// Long-term locks for processes
struct sleeplock {
uint locked; // Is the lock held?
struct spinlock lk; // spinlock protecting this sleep lock
// For debugging:
char *name; // Name of lock.
int pid; // Process holding lock
};
void acquiresleep(struct sleeplock*);
void releasesleep(struct sleeplock*);
int holdingsleep(struct sleeplock*);
void initsleeplock(struct sleeplock*, char*);
#endif