Skip to main content

Module ffi_guard

Module ffi_guard 

Source
Expand description

Containment for FFI entry points: native callbacks, JNI up-calls, posted-closure trampolines. A Rust panic unwinding out of an extern "C" frame is undefined behavior (an abort), so every backend trampoline runs its body through ffi_guard::contain: a caught panic is reported, the installed recovery hook restores runtime coherence (day-core installs the reactive runtime’s recover_from_panic at boot), and the given default is returned.

Functions§

contain
Run f, containing any panic; on panic, report, run the recovery hook, and return default.
set_recovery
Install the post-panic recovery hook (idempotent; first install wins). day-core registers day_reactive::recover_from_panic here so a contained panic cannot leave the reactive observer stack stranded.