package eio

  1. Overview
  2. Docs

Timeout values.

type t
val of_s : clock -> float -> t
  • deprecated Use [seconds] instead, with a monotonic clock
val v : Mono.t -> Mtime.Span.t -> t

v clock duration is a timeout of duration, as measured by clock. Internally, this is just the tuple (clock, duration).

val seconds : Mono.t -> float -> t

seconds clock duration is a timeout of duration seconds, as measured by clock.

val none : t

none is an infinite timeout.

val run : t -> (unit -> ('a, 'e) result) -> ('a, [> `Timeout ] as 'e) result

run t fn runs fn () but cancels it if it takes longer than allowed by timeout t.

val run_exn : t -> (unit -> 'a) -> 'a

run_exn t fn runs fn () but cancels it if it takes longer than allowed by timeout t, raising exception Timeout.

val pp : t Fmt.t

pp formats a timeout as a duration (e.g. "5s"). This is intended for use in error messages and logging and is rounded.

OCaml

Innovation. Community. Security.