Module Gc
module Gc: Async_gc
include Core.Gc
val add_finalizer : 'a -> ('a -> unit) -> unit
add_finalizer f x
is like
Gc.finalise f x
, except that the finalizer is guaranteed
to run as an Async job (i.e. without interrupting other Async jobs). Unprotected use
of
Caml.Gc.finalise
or
Core.Gc.add_finalizer
in Async programs is wrong, because
the finalizers won't hold the async lock, and thus could interleave arbitrarily with
async jobs.
val add_finalizer_exn : 'a -> ('a -> unit) -> unit
val finalise : [< `In_async__use_finalize_not_finalise ] ->
'a -> [> `In_async__use_finalize_not_finalise ]
finalise
is rebound to avoid accidental use in Async programs.