const Instance = struct thread: WasiThreadtls_offset: usizeContains the offset to the new __tls_base. The offset starting from the memory's base.
stack_offset: usizeContains the offset to the stack for the newly spawned thread. The offset is calculated starting from the memory's base.
raw_ptr: usizeContains the raw pointer value to the wrapper which holds all arguments for the callback.
call_back: *const fn (usize) voidFunction 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: [*]u8When 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.
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,
}
A meta-data structure used to bootstrap a thread