Mkernel.HookType of hooks.
Unlike Miou hooks, Mkernel's hooks only are executed when we perform the yield hypercall. In other words, these hooks only execute when waiting for a new external event.
Such a hook can be useful for certain computations because the hook is only executed when truly random events occur: the occurrence of external events.
val add : (unit -> unit) -> tadd fn adds a new hook (a function) which will be executed at every new external events.
A hook cannot interact with the scheduler and, what's more, cannot use the effects associated with Miou. Miou's effects manager is not attached to it. If the given function raises an exception, the hook is deleted. The user can remove the actual hook with remove. It should be noted that if the user attempts to perform a Miou effect, an Effect.Unhandled exception is raised, which results in the hook being removed.
val remove : t -> unitremove h removes the hook h. If h does not belong to the internal state of Mkernel, it raises an exception Invalid_argument.