pub unsafe fn thread_spawn(
    user_data: u64,
    stack_base: u64,
    stack_start: u64,
    reactor: Bool
) -> Result<Tid, Errno>
Expand description

Creates a new thread by spawning that shares the same memory address space, file handles and main event loops. The web assembly process must export function named ‘_start_thread’

Parameters

  • user_data - User data that will be supplied to the function when its called
  • stack_base - The base address of the stack allocated for this thread
  • stack_start - The start address of the stack (where the memory is allocated)
  • reactor - Indicates if the function will operate as a reactor or as a normal thread. Reactors will be repeatable called whenever IO work is available to be processed.

Return

Returns the thread index of the newly created thread (indices always start from zero)