Module thread

Module thread 

Source
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§

ContextSwitchFrame 🔒
A struct to mimic a stack state on context switch.
Current
The opaque structure indicating the running thread on the current cpu.
JoinHandle
A handle to join thread.
ParkHandle
A handle that represent the parked thread.
Thread
An thread abstraction.
ThreadBuilder
A struct to build a new thread.
TtyState 🔒

Enums§

ThreadState
A possible state of the thread.

Constants§

STACK_SIZE
Size of each thread’s stack.
THREAD_MAGIC
Thread magic to detect stack overflow.

Statics§

EXIT_CODE_TABLE 🔒
THREAD_STATE_TABLE 🔒

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 ThreadState by TID (Thread ID).
kill_by_tid
Kill the thread by specified TID (Thread ID).
load_pt 🔒
with_current
Run a function f with current thread as an argument.

Type Aliases§

ThreadPinGuard
A RAII implementation of the thread pinning.