Advertisement
argent_smith

threads

Dec 27th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.31 KB | None | 0 0
  1.   let rec loop1 () =
  2.     Lwt_unix.sleep 1.0 >>= (fun () -> Log.info "foo") >>= (fun () -> loop1 ())
  3.   in
  4.   let rec loop2 () =
  5.     Lwt_unix.sleep 2.0 >>= (fun () -> Log.info "bar") >>= (fun () -> loop2 ())
  6.   in
  7.   let threads = [
  8.       loop1 (); loop2 (); fail_with "bah!"
  9.     ] in
  10.   Lwt_main.run @@ join threads
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement