diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-24 23:25:07 +0200 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-24 23:25:07 +0200 |
commit | 6e750a757ef6fb1f41cf4c2fe39edba834b76858 (patch) | |
tree | f339630beb8a9a1a6f3544b40547ce9c83f23a91 /src/primes.ml | |
parent | c5e69a904e79e807c5b075c08ce82183133e7b4c (diff) | |
download | SystemeReseaux-Projet-6e750a757ef6fb1f41cf4c2fe39edba834b76858.tar.gz SystemeReseaux-Projet-6e750a757ef6fb1f41cf4c2fe39edba834b76858.zip |
./manager -local-proc 4 ./example.native does what expected.
Diffstat (limited to 'src/primes.ml')
-rw-r--r-- | src/primes.ml | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/primes.ml b/src/primes.ml index b9a57ed..21d979a 100644 --- a/src/primes.ml +++ b/src/primes.ml @@ -26,20 +26,25 @@ module Primes (K : Kahn.S) = struct (get qi) >>= (fun v -> if v <> -1 then begin - Format.printf "%d@." v; + Format.eprintf "%d@." v; (delay new_channel ()) >>= (fun (qi2, qo2) -> doco [ filter v qi qo2 ; primes qi2 ]) end else return ()) - let main : unit process = + let main : int process = (delay new_channel ()) >>= - (fun (q_in, q_out) -> doco [ integers 2000 q_out ; primes q_in ]) + (fun (q_in, q_out) -> doco [ integers 500 q_out ; primes q_in ]) + >>= (fun () -> return 42) end -module Eng = Kahn_pipe.Pipe +module Eng = Kahn_stdio.ProtoKahn module P = Primes(Eng) -let () = P.K.run P.main +let () = + let r = P.K.run P.main in + assert (r = 42); + Format.eprintf "Primes finished (%d \\o/).@." r + |