package containers

  1. Overview
  2. Docs
A modular, clean and powerful extension of the OCaml standard library

Install

Dune Dependency

Authors

Maintainers

Sources

v2.8.1.tar.gz
md5=d84e09c5d0abc501aa17cd502e31a038
sha512=8b832f4ada6035e80d81be0cfb7bdffb695ec67d465ed6097a144019e2b8a8f909095e78019c3da2d8181cc3cd730cd48f7519e87d3162442562103b7f36aabb

doc/containers.thread/CCTimer/index.html

Module CCTimerSource

Event timer

Used to be part of CCFuture.

  • since 0.16
Sourcetype t

A scheduler for events. It runs in its own thread.

Sourceval create : unit -> t

A new timer.

Sourceval set_exn_handler : t -> (exn -> unit) -> unit

set_exn_handler timer f registers f so that any exception raised by a task scheduled in timer is given to f.

Sourceexception Stopped
Sourceval after : t -> float -> f:(unit -> _) -> unit

Call the callback f after the given number of seconds.

  • raises Stopped

    if the timer was stopped.

Sourceval at : t -> float -> f:(unit -> _) -> unit

Create a future that evaluates to () at the given Unix timestamp.

  • raises Stopped

    if the timer was stopped.

Sourceexception ExitEvery
Sourceval every : ?delay:float -> t -> float -> f:(unit -> _) -> unit

every timer n ~f calls f () every n seconds. f() can raise ExitEvery to stop the cycle.

  • parameter delay

    if provided, the first call to f () is delayed by that many seconds.

  • raises Stopped

    if the timer was stopped.

Sourceval stop : t -> unit

Stop the given timer, cancelling pending tasks. Idempotent. From now on, calling most other operations on the timer will raise Stopped.

Sourceval active : t -> bool

Return true until stop t has been called.

OCaml

Innovation. Community. Security.

On This Page
  1. Event timer