]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/include/kern/lock.h
Random stuff.
[polintos/scott/priv.git] / kernel / include / kern / lock.h
1 #ifndef _KERN_LOCK_H
2 #define _KERN_LOCK_H
3
4 #include <kern/kernel.h>
5 #include <kern/spinlock.h>
6 #include <kern/sched.h>
7 #include <util/spinlock.h>
8
9 namespace Lock {
10         extern int dying;
11
12         struct Lock {
13                 SpinLock spinlock;
14                 Threads::WaitQueue waitqueue;
15                 ulong lockval;
16                 
17                 Lock()
18                 {
19                         lockval = 0;
20                 }
21                 
22                 void lock();
23                 void unlock();
24
25                 // Include kern/thread.h for inline definition
26                 bool held_by_curthread();
27         };
28 }
29
30 #endif