ps: initial process subsystem

This commit is contained in:
Loïc Grégoire
2026-06-18 18:54:38 -04:00
parent 42b10b886e
commit e50b1e0167
9 changed files with 92 additions and 73 deletions
+4 -3
View File
@@ -111,15 +111,16 @@ pub const Thread = struct {
/// Initialize a thread.
/// - `stack`: Address of the **base** of the stack on which the initial context for the thread is built
/// - `stack_size`: Size of the stack
/// - `prio`: Base priority of the thread
/// - `entry`: Entry point of the thread
/// - `arg`: Extraneous argument to be passed to `entry`
pub fn init(thread: *Thread, stack: r.VAddr, stack_size: usize, entry: *const fn (?*anyopaque) void, arg: ?*anyopaque) void {
pub fn init(thread: *Thread, stack: r.VAddr, stack_size: usize, prio: u8, entry: *const fn (?*anyopaque) void, arg: ?*anyopaque) void {
thread.* = .{
.context = .init(stack, stack_size, entry, arg),
.lock = .init(),
.nice = 0,
.priority = Thread.Priority.default,
.base_priority = Thread.Priority.default,
.priority = prio,
.base_priority = prio,
.inherited_prio = 0,
.sleep_start = 0,
.sleep_time = 0,