Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › Io/ › Kqueue.zig › Thread
Thread
Kqueue.Thread
const Thread = struct
File
Code
const Thread = struct {
thread : std .Thread ,
idle_context : Io .fiber .Context ,
current_context : *Io .fiber .Context ,
ready_queue : ?*Fiber ,
kq_fd : posix .fd_t ,
idle_search_index : u32 ,
steal_ready_search_index : u32 ,
wait_queues : std .array_hash_map .Auto (WaitQueueKey , *Fiber ),
const WaitQueueKey = struct {
ident : usize ,
filter : i32 ,
};
const canceling : ?*Thread = @ptrFromInt (@alignOf (Thread ));
threadlocal var self : *Thread = undefined ;
fn current () *Thread {
return self ;
}
fn currentFiber (thread : *Thread ) *Fiber {
return @fieldParentPtr ("context" , thread .current_context );
}
const List = struct {
allocated : []Thread ,
reserved : u32 ,
active : u32 ,
};
fn deinit (thread : *Thread , gpa : Allocator ) void {
closeFd (thread .kq_fd );
assert (thread .wait_queues .count () == 0 );
thread .wait_queues .deinit (gpa );
thread .* = undefined ;
}
}