Skip to main content

nova_rt_task_take_output

Function nova_rt_task_take_output 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C-unwind" fn nova_rt_task_take_output( id: i64, ) -> i64
Expand description

A completed task’s output slot, taken exactly once.

Taking releases the GC root that was keeping the output alive, so this must be called once per task and only after nova_rt_task_is_done reports true. Only block_on’s root still has that root when it completes, and run_to_completion takes it itself; every other task’s root is released at completion, so taking its output panics, naming that cause. A second take, or a take before completion, panics too – see [take_output_internal].

"C-unwind": see nova_rt_task_is_done’s doc comment.

§Safety

id must be an id previously returned by nova_rt_task_spawn on this same thread.

§Panics

If id is unknown, if task id has not completed, or if its output has already been taken.