Skip to main content

spawn_raw_with_extension

Function spawn_raw_with_extension 

Source
pub unsafe fn spawn_raw_with_extension<F>(
    entry: F,
    name: String,
    stack_size: usize,
    os_extension: Option<ThreadExtension>,
) -> Result<ThreadHandle, TaskError>
where F: FnOnce() + Send + 'static,
Expand description

Creates a kernel thread while retaining one OS-specific extension.

The runtime owns an outer extension for the closure and join metadata. It forwards switch, exit, Deadline-overrun and final-drop callbacks to os_extension, preserving the inner callback-table address as its type identity for StarryOS or another consuming OS.

ยงSafety

When present, os_extension transfers its unique callback-data ownership to this function. The caller must not install another copy or invoke its drop callback, regardless of whether thread creation succeeds.