Skip to content

Instantly share code, notes, and snippets.

@alinpopa
Created April 30, 2017 10:09
Show Gist options
  • Save alinpopa/56343b583e155f85017e033cacfe6e2e to your computer and use it in GitHub Desktop.
Save alinpopa/56343b583e155f85017e033cacfe6e2e to your computer and use it in GitHub Desktop.
(*
*Compile with:
*ocamlfind ocamlc -o test_async -thread -linkpkg -package core,async test_async.ml
*Run with:
*./test_async
*)
open Async.Std
open Core.Std
open Async.Std.Deferred.Infix
let () =
Clock.run_after (sec 5.0) (fun _ -> print_endline "After 5 seconds") ();
Clock.run_after (sec 10.0) (fun _ -> print_endline "After 10 seconds") ();
Clock.every (sec 1.0) (fun () -> print_endline " From clock 1!");
Clock.every (sec 2.0) (fun () -> print_endline " From clock 2!");
never_returns (Scheduler.go ())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment