Skip to main content

start_process

Function start_process 

Source
pub unsafe fn start_process<K: 'static>(
    stack: Stack,
    owner: ProcessOwner<K>,
    entry: NativeEntry,
    launch: Option<ProcessLaunch>,
) -> impl Future<Output = i32> + 'static
Expand description

Run entry as a process on the calling task, as a future that resolves to its exit status, without spawning a task for it.

The coroutine runs inside the task that polls the future, which is how the process learns its identity. Dropping the future before it completes cancels the program: its coroutine stack is freed, with no destructor run on it, and everything it held is released. Without a launch the program gets no process capability.

ยงSafety

entry obeys the startup lifetime rules, fits on stack, and returns without unwinding. The future is polled on the executor that created it and keeps all native execution on it.