Zig.Nif.Yielding (zigler v0.9.1) View Source

Generates code for yielding nifs.

yielding functions require several parts to get right.

  1. a zig struct that holds the frame of the async function and also information to be filled in for the yielding allocator.

  2. 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.

  3. 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.

  4. a harness function which takes care of informing the supervisor that target function has been completed.

Link to this section Summary

Link to this section Functions

Specs

frame_resources(Zig.Parser.Nif.t()) :: iodata()

Specs

harness_fns(Zig.Parser.Nif.t()) :: iodata()

Specs

launcher_fns(Zig.Parser.Nif.t()) :: iodata()

Specs

rescheduler_fn(Zig.Parser.Nif.t()) :: iodata()

the rescheduler fn is a seam between the tail-call reentrancy of the BEAM FFI.