mutex
include/sync/mutex.h View source View on GitHubStructs
Section titled “Structs”mutex_simple
Section titled “mutex_simple”struct mutex_simple {
struct thread *owner;
struct thread_queue waiters;
struct spinlock lock;
}; struct mutex {
_Atomic (uintptr_t) lock_word;
}; Functions
Section titled “Functions”mutex_simple_init
Section titled “mutex_simple_init”void mutex_simple_init(struct mutex_simple *m); mutex_simple_lock
Section titled “mutex_simple_lock”void mutex_simple_lock(struct mutex_simple *m); mutex_simple_unlock
Section titled “mutex_simple_unlock”void mutex_simple_unlock(struct mutex_simple *m); mutex_init
Section titled “mutex_init”void mutex_init(struct mutex *mtx); mutex_unlock
Section titled “mutex_unlock”void mutex_unlock(struct mutex *mutex); mutex_lock
Section titled “mutex_lock”void mutex_lock(struct mutex *mutex); mutex_held
Section titled “mutex_held”bool mutex_held(struct mutex *mtx); mutex_get_owner
Section titled “mutex_get_owner”struct thread * mutex_get_owner(struct mutex *mtx); Macros
Section titled “Macros”MUTEX_INIT
Section titled “MUTEX_INIT”#define MUTEX_INIT {ATOMIC_VAR_INIT(0)} MUTEX_ASSERT_HELD
Section titled “MUTEX_ASSERT_HELD”#define MUTEX_ASSERT_HELD(m) kassert(mutex_held(m))