Module Fut_backend_base

Fut backend base module.

Implements the exception trap and defines backend tools and signatures.

Exception trap

type exn_ctx = [
| `Queue of string
| `Future
| `Finalizer
| `Backend
| `Fd_action
| `Timer_action
| `Signal_action
| `Runtime_action
| `Exn_trap
]

The type for exception contexts.

type exn_info = exn_ctx * exn * Stdlib.Printexc.raw_backtrace

The type for info about trapped exceptions. The context, the exception, and the backtrace.

val set_exn_trap : (exn_info -> unit) -> unit

set_exn_trap h is a function called whenever the runtime system catches an exception.

val pp_exn_info : Stdlib.Format.formatter -> exn_info -> unit

pp_exn_info ppf i prints an unspecified representation of i on ppf.

val exn_trap : exn_ctx -> exn -> Stdlib.Printexc.raw_backtrace -> unit

exn_traps ctx exn bt traps the exception exn in context ctx with backtrace bt.

val trap : exn_ctx -> ('a -> unit) -> 'a -> unit

trap ctx f x executes f x and if it raises traps the exception with context ctx.

Backend tools

val err_invalid_worker_count : int -> string

err_invalid_worker_count n is a string to raise Invalid_argument whenever set_worker_count is called with n < 0.

Queues

val queue_auto_label : unit -> string

queue_auto_label () is a new label for a queue.

Backend interface

type abort = unit -> unit

See Fut.Runtime.abort.

module type Backend = sig ... end

Fut backend interface.