Skip to main content

GC_register_disappearing_link

Function GC_register_disappearing_link 

Source
pub unsafe extern "C" fn GC_register_disappearing_link(
    arg1: *mut *mut c_void,
) -> c_int
Expand description

This routine may be used to break cycles between finalizable objects, thus causing cyclic finalizable objects to be finalized in the correct order. The standard use involves calling GC_register_disappearing_link(&p), where p is a pointer that is not followed by finalization code, and should not be considered in determining finalization order. link should point to a field of a heap-allocated object. *link will be cleared when the object is found to be inaccessible. This happens before any finalization code is invoked, and before any decisions about finalization order are made. This is useful in telling the finalizer that some pointers are not essential for proper finalization. This may avoid finalization cycles. Note that the object may be resurrected by another finalizer, and thus the clearing of *link may be visible to non-finalization code. There is an argument that an arbitrary action should be allowed here, instead of just clearing a pointer. But this causes problems if that action alters, or examines connectivity. Returns GC_DUPLICATE if given link was already registered, GC_SUCCESS if registration succeeded, GC_NO_MEMORY if it failed for lack of memory (and GC_oom_fn did not handle the problem). Only exists for backward compatibility, use GC_general_register_disappearing_link() instead.