zigler v0.7.1 Zig.Nif.Yielding View Source
Generates code for yielding nifs.
yielding functions require several parts to get right.
a zig struct that holds the frame of the async function and also information to be filled in for the yielding allocator.
a
launcher
function which serves as the interface between the C abi, which cannot tolerate async functions and zig function that is going to be called.a
supervisor
function which is responsible for resuming the async function. This is the event loop, but it uses a tail-call sort of a system that Erlang is used to.a
harness
function which takes care of informing the supervisor that target function has been completed.
Link to this section Summary
Functions
the rescheduler fn is a seam between the tail-call reentrancy of the BEAM FFI.
Link to this section Functions
frame_resources(nif)
View Sourceframe_resources(Zig.Parser.Nif.t()) :: iodata()
rescheduler_fn(nif)
View Sourcerescheduler_fn(Zig.Parser.Nif.t()) :: iodata()
the rescheduler fn is a seam between the tail-call reentrancy of the BEAM FFI.