|
ginnOS
The reference: libc, the libraries and the kernel
|
sleeping mutex for long critical sections in process context (filesystem and disk I/O). More...
#include </home/runner/work/ginnOS-docs/ginnOS-docs/ginnOS/src/kernel/sync/mutex.h>
Data Fields | |
| volatile bool | locked |
| struct process * | owner |
| wait_queue_t | waiters |
| spinlock_t | lock |
sleeping mutex for long critical sections in process context (filesystem and disk I/O).
a process that finds the mutex held blocks on its wait queue instead of spinning or masking interrupts, so interrupts and other processes keep running while the holder works.
never take a mutex from an interrupt handler, and never block on one while holding a spinlock. use a spinlock for short sections shared with IRQs. a mutex. zero-initialized (or MUTEX_INIT) means unlocked.
| volatile bool mutex_t::locked |
| struct process* mutex_t::owner |
| wait_queue_t mutex_t::waiters |
| spinlock_t mutex_t::lock |