Skip to content

Commit

Permalink
mrr
Browse files Browse the repository at this point in the history
Signed-off-by: TalonFloof <[email protected]>
  • Loading branch information
TalonFloof committed Nov 16, 2024
1 parent 101e121 commit c0882cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kobold/kernel/team.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const std = @import("std");
const thread = @import("thread.zig");
const Spinlock = @import("root").Spinlock;
const hal = @import("root").hal;
const RedBlackTree = @import("perlib").RedBlackTree;

pub const Team = struct {
teamID: i64,
Expand All @@ -11,3 +12,9 @@ pub const Team = struct {
aspaceLock: Spinlock = .unaquired,
addressSpace: hal.memmodel.PageDirectory,
};

const TeamTreeType = RedBlackTree(*Team, struct {
fn compare(a: *Team, b: *Team) std.math.Order {
return std.math.order(a.teamID, b.teamID);
}
}.compare);
7 changes: 7 additions & 0 deletions kobold/kernel/thread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const std = @import("std");
const hal = @import("root").hal;
const Spinlock = @import("root").Spinlock;
const team = @import("team.zig");
const RedBlackTree = @import("perlib").RedBlackTree;

pub const ThreadState = enum {
Embryo,
Expand All @@ -27,3 +28,9 @@ pub const Thread = struct {
};

pub const ThreadList = std.DoublyLinkedList(*Thread);

const ThreadTreeType = RedBlackTree(*Thread, struct {
fn compare(a: *Thread, b: *Thread) std.math.Order {
return std.math.order(a.threadID, b.threadID);
}
}.compare);
1 change: 1 addition & 0 deletions kobold/perLib/perlib.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const std = @import("std");
pub const Spinlock = @import("spinlock.zig").Spinlock;
pub const RedBlackTree = @import("rbtree.zig").RedBlackTree;

pub const KernelCall = enum {
Log,
Expand Down

0 comments on commit c0882cb

Please sign in to comment.