package qcow

  1. Overview
  2. Docs


module Time : V1_LWT.TIME


type t

A timer which runs a background task after a set duration. The timer can be reset at any time. The timer guarantees to wait at least the set duration before running the task again.

val make : f:(unit -> unit Lwt.t) -> description:string -> unit -> t

Create timer which is initially stopped.

val restart : t -> duration_ms:int -> unit

Restart the timer.

If the task is running now then another will be scheduled to start duration_ms milliseconds after the running one has finished.

If no task is running then any existing scheduled task is removed and a new one is scheduled for duration_ms from now.

val cancel : t -> unit

If an operation is in progress, cancel and reschedule it.


Innovation. Community. Security.