Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Private Struct

Instance

Private Struct
std.Thread.WasiThreadImpl.Instance
const Instance = struct

A meta-data structure used to bootstrap a thread

Fields

thread: WasiThread
tls_offset: usize

Contains the offset to the new __tls_base. The offset starting from the memory's base.

stack_offset: usize

Contains the offset to the stack for the newly spawned thread. The offset is calculated starting from the memory's base.

raw_ptr: usize

Contains the raw pointer value to the wrapper which holds all arguments for the callback.

call_back: *const fn (usize) void

Function pointer to a wrapping function which will call the user's function upon thread spawn. The above mentioned pointer will be passed to this function pointer as its argument.

original_stack_pointer: [*]u8

When a thread is in detached state, we must free all of its memory upon thread completion. However, as this is done while still within the thread, we must first jump back to the main thread's stack or else we end up freeing the stack that we're currently using.

File

Thread.zig:833
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
    const Instance = struct {
        thread: WasiThread,
        /// Contains the offset to the new __tls_base.
        /// The offset starting from the memory's base.
        tls_offset: usize,
        /// Contains the offset to the stack for the newly spawned thread.
        /// The offset is calculated starting from the memory's base.
        stack_offset: usize,
        /// Contains the raw pointer value to the wrapper which holds all arguments
        /// for the callback.
        raw_ptr: usize,
        /// Function pointer to a wrapping function which will call the user's
        /// function upon thread spawn. The above mentioned pointer will be passed
        /// to this function pointer as its argument.
        call_back: *const fn (usize) void,
        /// When a thread is in `detached` state, we must free all of its memory
        /// upon thread completion. However, as this is done while still within
        /// the thread, we must first jump back to the main thread's stack or else
        /// we end up freeing the stack that we're currently using.
        original_stack_pointer: [*]u8,
    }