threads(M6): getCurrentId, docs, and CI wiring — threading built
New thread_self=42 syscall backs runtime.Thread.getCurrentId (the calling thread's kernel task id). thread-test gains an id mode: two workers read getCurrentId and the main thread confirms all three ids are non-zero and distinct. Per-thread threadlocal TLS is deferred by design (no consumer; it would need context-switched fs.base for an unused feature), as are RwLock/WaitGroup. Marks the threading feature built (M1-M6): threading.md + docs/README.md status updated, all thread-* cases wired into qemu_test.py. Gate thread-id PASS; full suite green: 21/21 (thread-spawn/join/futex/mutex/id, aspace-refcount, + 15 guardrail cases), zig build clean, zig build test green.
This commit is contained in:
@@ -100,6 +100,11 @@ pub const Thread = struct {
|
||||
_ = self;
|
||||
}
|
||||
|
||||
/// The calling thread's id (its kernel task id). Mirrors `std.Thread.getCurrentId`.
|
||||
pub fn getCurrentId() Id {
|
||||
return @intCast(sc.systemCall0(.thread_self));
|
||||
}
|
||||
|
||||
/// The dense 0-based index of the core the calling thread is running on. A danos
|
||||
/// extension beyond `std.Thread`, used to observe genuine cross-core parallelism.
|
||||
pub fn currentCore() Id {
|
||||
|
||||
Reference in New Issue
Block a user