package async_kernel

  1. Overview
  2. Docs
Monadic concurrency library

Install

Dune Dependency

Authors

Maintainers

Sources

async_kernel-v0.15.0.tar.gz
sha256=30753e014bb0b127ee59f10b1073b8ae476468fb2f07dc8c99dbe2ef312fc696

doc/src/async_kernel/clock_ns.ml.html

Source file clock_ns.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
open! Core
open! Import

module type Clock = Clock_intf.Clock
module type Clock_deprecated = Clock_intf.Clock_deprecated

module Or_timeout = Clock_intf.Or_timeout
module Scheduler = Scheduler1

let time_source () = (Scheduler.t ()).time_source |> Time_source.of_synchronous
let after span = Time_source.after (time_source ()) span
let at time = Time_source.at (time_source ()) time

let at_varying_intervals ?stop compute_span =
  Time_source.at_varying_intervals ?stop (time_source ()) compute_span
;;

let at_intervals ?start ?stop interval =
  Time_source.at_intervals ?start ?stop (time_source ()) interval
;;

let every' ?start ?stop ?continue_on_error ?finished span f =
  Time_source.every' ?start ?stop ?continue_on_error ?finished (time_source ()) span f
;;

let every ?start ?stop ?continue_on_error span f =
  Time_source.every ?start ?stop ?continue_on_error (time_source ()) span f
;;

let run_after span f a = Time_source.run_after (time_source ()) span f a
let run_at time f a = Time_source.run_at (time_source ()) time f a

let run_at_intervals ?start ?stop ?continue_on_error interval f =
  Time_source.run_at_intervals ?start ?stop ?continue_on_error (time_source ()) interval f
;;

let run_at_intervals' ?start ?stop ?continue_on_error interval f =
  Time_source.run_at_intervals'
    ?start
    ?stop
    ?continue_on_error
    (time_source ())
    interval
    f
;;

let with_timeout span d = Time_source.with_timeout (time_source ()) span d
let duration_of f = Time_source.duration_of (time_source ()) f

module Event = struct
  include Time_source.Event

  let after span = after (time_source ()) span
  let run_after span f a = run_after (time_source ()) span f a
  let at time = at (time_source ()) time
  let run_at time f z = run_at (time_source ()) time f z
end
OCaml

Innovation. Community. Security.