Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Concurrent-computing/OCaml/concurrent-computing.ocaml
Normal file
14
Task/Concurrent-computing/OCaml/concurrent-computing.ocaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#directory "+threads"
|
||||
#load "unix.cma"
|
||||
#load "threads.cma"
|
||||
|
||||
let sleepy_print msg =
|
||||
Unix.sleep (Random.int 4);
|
||||
print_endline msg
|
||||
|
||||
let threads =
|
||||
List.map (Thread.create sleepy_print) ["Enjoy"; "Rosetta"; "Code"]
|
||||
|
||||
let () =
|
||||
Random.self_init ();
|
||||
List.iter (Thread.join) threads
|
||||
Loading…
Add table
Add a link
Reference in a new issue