Skip to main content

nix_gc_register_finalizer

Function nix_gc_register_finalizer 

Source
pub unsafe extern "C" fn nix_gc_register_finalizer(
    obj: *mut c_void,
    cd: *mut c_void,
    finalizer: Option<unsafe extern "C" fn(obj: *mut c_void, cd: *mut c_void)>,
)
Expand description

Register a callback that gets called when the object is garbage collected.

Note Objects can only have a single finalizer. This function overwrites existing values silently.

ยงArguments

  • obj [in] - the object to watch
  • cd [in] - the data to pass to the finalizer
  • finalizer [in] - the callback function, called with obj and cd