Skip to main content

nova_rt_task_yield_future

Function nova_rt_task_yield_future 

Source
#[unsafe(no_mangle)]
pub extern "C-unwind" fn nova_rt_task_yield_future() -> *mut u8
Expand description

A fresh Future<unit> that pends once and then completes – what std/task’s yield_now awaits.

The state object is fresh on every call, not a shared static: the whole value carried by one of these futures is its resume tag, so two suspensions alive at once would otherwise be one suspension, and the second task to poll would find the first task’s tag already advanced and complete without ever having yielded.

Builds exactly the layout nova_rt_task_spawn documents and async_lower.rs independently emits, via [build_future] – see its doc comment for why that layout now has exactly one home. [poll_yield_once] is the poll function and [YIELD_STATE_SIZE] the state size. Reproducing a layout the compiler also emits is a silent miscompile when it is wrong, which is why the_yield_futures_layout_is_the_one_the_abi_declares asserts the tracked (size, scan) of both allocations rather than only the words written into them.