pub unsafe extern "C" fn GC_do_blocking(
arg1: GC_fn_type,
arg2: *mut c_void,
) -> *mut c_voidExpand description
Wrapper for functions that are likely to block (or, at least, do not
allocate garbage-collected memory and/or manipulate pointers to the
garbage-collected heap) for an appreciable length of time.
While fn is running, the collector is said to be in the “inactive”
state for the current thread (this means that the thread is not
suspended and the thread’s stack frames “belonging” to the functions
in the “inactive” state are not scanned during garbage collections).
It is assumed that the collector is already initialized and the
current thread is registered. It is allowed for fn to call
GC_call_with_gc_active() (even recursively), thus temporarily
toggling the collector’s state back to “active”. The latter
technique might be used to make stack scanning more precise (i.e.
scan only stack frames of functions that allocate garbage-collected
memory and/or manipulate pointers to the garbage-collected heap).
Acquires the allocator lock in the reader mode (but fn is called
not holding it).