Module Core_kernel__.Ephemeron

An ephemeron is a pair of pointers, one to a "key" and one to "data".

The key pointer is a weak pointer: the garbage collector doesn't follow it when determining liveness. The garbage collector follows an ephemeron's data pointer iff the key is alive. If the garbage collector nulls an ephemeron's weak pointer then it also nulls the data pointer. Ephemerons are more powerful than weak pointers because they express conjunction of liveness -- the data in an ephemeron is live iff both the key and the ephemeron are live. See "Ephemerons: A New Finalization Mechanism", Barry Hayes 1997.

This module is like the OCaml standard library module Ephemerons.K1, except that it requires that the keys and data are heap blocks.

type ('a, 'b) t
include sig ... end
val sexp_of_t : ('a ‑> Base.Sexp.t) ‑> ('b ‑> Base.Sexp.t) ‑> ('a'bt ‑> Base.Sexp.t
val create : Core_kernel__.Import.unit ‑> (__t
val set_key : ('a_t ‑> 'a Core_kernel__.Import.Heap_block.t Core_kernel__.Import.option ‑> Core_kernel__.Import.unit
val get_key : ('a_t ‑> 'a Core_kernel__.Import.Heap_block.t Core_kernel__.Import.option
val set_data : (_'bt ‑> 'b Core_kernel__.Import.Heap_block.t Core_kernel__.Import.option ‑> Core_kernel__.Import.unit
val get_data : (_'bt ‑> 'b Core_kernel__.Import.Heap_block.t Core_kernel__.Import.option
val is_key_some : (__t ‑> Core_kernel__.Import.bool
val is_key_none : (__t ‑> Core_kernel__.Import.bool
val is_data_some : (__t ‑> Core_kernel__.Import.bool
val is_data_none : (__t ‑> Core_kernel__.Import.bool