Time.Timeout
Timeout values.
v clock duration
is a timeout of duration
, as measured by clock
. Internally, this is just the tuple (clock, duration)
.
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) Stdlib.result) ->
('a, [> `Timeout ] as 'e) Stdlib.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 sleep : t -> unit
sleep t
sleeps for t
's duration.
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.