Expand description
Thread abstration, an abstraction of a cpu core.
§The threading model
An executing kernel consists of a collection of threads, each with their own stack and local state. Threads can be named, and provide some built-in support for low-level synchronization.
Modules§
- scheduler
- Thread scheduler
Structs§
- Context
Switch 🔒Frame - A struct to mimic a stack state on context switch.
- Current
- The opaque structure indicating the running thread on the current cpu.
- Join
Handle - A handle to join thread.
- Park
Handle - A handle that represent the parked thread.
- Thread
- An thread abstraction.
- Thread
Builder - A struct to build a new thread.
- TtyState 🔒
Enums§
- Thread
State - A possible state of the thread.
Constants§
- STACK_
SIZE - Size of each thread’s stack.
- THREAD_
MAGIC - Thread magic to detect stack overflow.
Statics§
Functions§
- __
check_ 🔒for_ signal - Check signal for current process and perform an exit when signaled.
- __
with_ 🔒current - context_
switch_ 🔒 ⚠trampoline - The context-switch magic.
- finish_
context_ 🔒 ⚠switch - get_
state_ by_ tid - Get specified thread’s
ThreadStateby TID (Thread ID). - kill_
by_ tid - Kill the thread by specified TID (Thread ID).
- load_pt 🔒
- with_
current - Run a function
fwith current thread as an argument.
Type Aliases§
- Thread
PinGuard - A RAII implementation of the thread pinning.