Skip to main content

nova_rt_task_block_on

Function nova_rt_task_block_on 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C-unwind" fn nova_rt_task_block_on( future: *mut u8, ) -> i64
Expand description

Drive this thread’s executor to quiescence and return future’s output. See [run_to_completion] for exactly what “quiescence” means here.

"C-unwind": see PollFn’s doc comment. [poll_one]’s status diagnostic leaves through this function’s resume_unwind below, so this is the boundary that permission is needed at.

Re-entrancy ends the process rather than unwinding out of it. A nested call means a poll function called block_on, and a poll function’s frame is generated code with no unwind description, so a panic raised here would have to be unwound through that frame to reach any handler. std/task’s block_on makes this reachable from ordinary Nova source (async fn f() { block_on(g()) } compiles), which is exactly why the diagnostic is an [abort_with] and not a panic!.

§Safety

future must satisfy nova_rt_task_spawn’s contract exactly – same FUTURE_SIZE-byte fat pointer, same non-null poll_code, and the same minimum of (STATE_SLOT_TEMPS + n_temps) * 8 scanned, writable bytes (never fewer than STATE_MIN_SIZE) for the state object, because STATE_SLOT_OUTPUT is read unconditionally on completion here too.

§Panics

If any polled task’s poll function returns a status that is neither POLL_PENDING nor POLL_READY (see [poll_one]).