Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
open Event
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
let reader count_source lines_dest =
|
||||
let file = open_in "input.txt" in
|
||||
let rec aux () =
|
||||
let line = try Some (input_line file)
|
||||
with End_of_file -> None in
|
||||
sync (send lines_dest line);
|
||||
match line with
|
||||
| Some _ -> aux ()
|
||||
| None -> let printed = sync (receive count_source) in
|
||||
Printf.printf "The task wrote %i strings\n" printed;
|
||||
close_in file
|
||||
in aux ()
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
let printer lines_source count_target =
|
||||
let rec aux i =
|
||||
match sync (receive lines_source) with
|
||||
| Some line -> print_endline line; aux ( i + 1 )
|
||||
| None -> sync (send count_target i)
|
||||
in aux 0
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
let _ =
|
||||
let count = new_channel ()
|
||||
and lines = new_channel ()
|
||||
in
|
||||
let _ = Thread.create (printer lines) count
|
||||
in reader count lines
|
||||
Loading…
Add table
Add a link
Reference in a new issue