1 
2 #ifndef __MUTEX_H__
3 #define __MUTEX_H__
4 
5 #define MTX_STATUS_UNLOCKED	0
6 #define MTX_STATUS_LOCKED	1
7 
8 typedef struct Mutex {
9     uint64_t		status;
10     Thread		*owner;
11     Spinlock		lock;
12     WaitChannel		chan;
13     LIST_ENTRY(Mutex)	buckets;
14 } Mutex;
15 
16 void Mutex_Init(Mutex *mtx, const char *name);
17 void Mutex_Destroy(Mutex *mtx);
18 void Mutex_Lock(Mutex *mtx);
19 int Mutex_TryLock(Mutex *mtx);
20 void Mutex_Unlock(Mutex *mtx);
21 
22 #endif /* __MUTEX_H__ */
23 
24