Macro zerogc::safepoint_recurse [−][src]
macro_rules! safepoint_recurse { ($context:ident, |$sub_context:ident| $closure:expr) => { ... }; ($context:ident, $root:expr, |$sub_context:ident, $new_root:ident| $closure:expr) => { ... }; ($context:ident, $root:expr, @managed_result, |$sub_context:ident, $new_root:ident| $closure:expr) => { ... }; }
Invoke the closure with a temporary GcContext, then perform a safepoint afterwards.
Normally returns a tuple ($updated_root, $closure_result)
.
If a value is provided it is considered as a root of garbage collection both for the safepoint and the duration of the entire context.
Safety
This macro is completely safe, although it expands to unsafe code internally.