Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created April 16, 2015 09:04
Show Gist options
  • Save Leonidas-from-XIV/c44f2770df12001a54e2 to your computer and use it in GitHub Desktop.
Save Leonidas-from-XIV/c44f2770df12001a54e2 to your computer and use it in GitHub Desktop.
Timeouts in Lwt; build with ocamlbuild -pkgs lwt.unix ti.native
let () =
let sleep, wake = Lwt.wait () in
let ti = Lwt_timeout.create 2 (fun () ->
print_endline "oh hai";
Lwt.wakeup_later wake ()) in
Lwt_timeout.start ti;
Lwt_main.run sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment