ocaml/otherlibs/threads/Tests/test6.ml

18 lines
266 B
OCaml

open Event
let ch = (new_channel() : string channel)
let rec f tag msg =
select [
send ch msg;
wrap (receive ch) (fun x -> print_string(tag ^ ": " ^ x); print_newline())
];
f tag msg
let _ =
Thread.new (f "A") "hello";
f "B" "world";
exit 0