#[unsafe(no_mangle)]pub unsafe extern "C" fn patch_seq_strand_spawn(
entry: extern "C" fn(Stack) -> Stack,
initial_stack: Stack,
) -> i64Expand description
Spawn a strand (coroutine) with initial stack
§Safety
entrymust be a valid function pointer that can safely execute on any threadinitial_stackmust be either null or a valid pointer to aStackValuethat:- Was heap-allocated (e.g., via Box)
- Has a ’static lifetime or lives longer than the coroutine
- Is safe to access from the spawned thread
- The caller transfers ownership of
initial_stackto the coroutine - Returns a unique strand ID (positive integer)
§Memory Management
The spawned coroutine takes ownership of initial_stack and will automatically
free the final stack returned by entry upon completion.