AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
lock.h
Go to the documentation of this file.
1
#ifndef _SYS_LOCK_H
2
#define _SYS_LOCK_H
3
4
/*
5
* The kernel lock (sys/lock.c): only one CPU at a time runs the kernel.
6
* See docs/kernel/smp.md.
7
*/
8
9
/* Takes and lets go of the lock; says whether this CPU holds it. */
10
void
kernel_lock
(
void
);
11
void
kernel_unlock
(
void
);
12
int
kernel_lock_held
(
void
);
13
14
/* For an interrupt or an exception: kernel_enter() takes the lock unless
15
* this CPU holds it already (it came from the kernel), and returns 1 if it
16
* took it; kernel_leave() then lets go of it on the way out. */
17
int
kernel_enter
(
void
);
18
void
kernel_leave
(
int
took);
19
23
void
arch_lock_spin
(
void
);
24
27
void
arch_lock_taken
(
void
);
28
29
#endif
/* ! _SYS_LOCK_H */
arch_lock_spin
void arch_lock_spin(void)
Runs in the kernel lock's wait loop, on each turn.
Definition
smp.c:20
arch_lock_taken
void arch_lock_taken(void)
Runs once this CPU has taken the kernel lock.
Definition
smp.c:25
kernel_unlock
void kernel_unlock(void)
Lets go of the kernel lock, for the next CPU waiting for it.
Definition
lock.c:46
kernel_lock_held
int kernel_lock_held(void)
Says whether this CPU holds the kernel lock.
Definition
lock.c:57
kernel_lock
void kernel_lock(void)
Takes the kernel lock, waiting for its turn if another CPU holds it.
Definition
lock.c:32
kernel_leave
void kernel_leave(int took)
Lets go of the kernel lock on leaving the kernel, if kernel_enter() took it.
Definition
lock.c:83
kernel_enter
int kernel_enter(void)
Takes the kernel lock on entering the kernel, unless this CPU holds it already (an exception inside t...
Definition
lock.c:68
kernel
include
sys
lock.h
Generated by
1.18.0