File: again.ml

package info (click to toggle)
ocaml-luv 0.5.14-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,504 kB
  • sloc: ml: 11,130; makefile: 6,223; sh: 4,592; ansic: 1,517; python: 38
file content (15 lines) | stat: -rw-r--r-- 423 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(* Tests that the OCaml callback is not deallocated by stop. *)
let () =
  Helpers.with_timer @@ fun timer ->

  Luv.Timer.start timer 0 ~repeat:1 begin fun () ->
    Luv.Timer.stop timer
    |> ok "second stop" @@ fun () ->
    print_endline "Called"
  end
  |> ok "start" @@ fun () ->

  Luv.Timer.stop timer |> ok "first stop" @@ fun () ->
  Luv.Timer.again timer |> ok "again" @@ fun () ->

  Luv.Loop.run () |> ignore