aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-13 11:16:30 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-13 11:16:30 +0100
commit8afa5bb9d6e5a0f59d13bcdc9bc2e153c336445d (patch)
treeff1957519ac3d5a6a22578429c7760b444cd76c4
parent4d3f12f167729ecb5de5b9bf8e18f9eca52beced (diff)
downloadSystemeReseaux-Projet-8afa5bb9d6e5a0f59d13bcdc9bc2e153c336445d.tar.gz
SystemeReseaux-Projet-8afa5bb9d6e5a0f59d13bcdc9bc2e153c336445d.zip
Commit uncommited stuff.
-rw-r--r--psr-SystemeReseaux-Projet.tar.gzbin0 -> 10448 bytes
-rw-r--r--screens/2014-05-25-011028_1366x768_scrot.pngbin0 -> 235757 bytes
-rw-r--r--screens/2014-05-25-011059_1366x768_scrot.pngbin0 -> 229658 bytes
-rw-r--r--screens/2014-05-25-011138_1366x768_scrot.pngbin0 -> 231084 bytes
-rw-r--r--screens/2014-05-25-011223_1366x768_scrot.pngbin0 -> 236944 bytes
-rw-r--r--screens/2014-05-25-012431_1366x768_scrot.pngbin0 -> 225663 bytes
-rw-r--r--screens/2014-05-25-012551_1366x768_scrot.pngbin0 -> 224837 bytes
-rw-r--r--screens/2014-05-25-012814_1366x768_scrot.pngbin0 -> 203009 bytes
-rw-r--r--screens/2014-05-25-012903_1366x768_scrot.pngbin0 -> 239982 bytes
-rw-r--r--screens/2014-05-25-012958_1366x768_scrot.pngbin0 -> 222623 bytes
-rw-r--r--screens/2014-05-25-013408_1366x768_scrot.pngbin0 -> 229475 bytes
-rw-r--r--screens/2014-05-25-013506_1366x768_scrot.pngbin0 -> 205700 bytes
-rw-r--r--screens/2014-05-25-122207_1366x768_scrot.pngbin0 -> 223102 bytes
-rw-r--r--screens/2014-05-25-122907_1366x768_scrot.pngbin0 -> 226570 bytes
-rw-r--r--screens/2014-05-25-123109_1366x768_scrot.pngbin0 -> 226140 bytes
-rw-r--r--screens/2014-05-25-123122_1366x768_scrot.pngbin0 -> 244605 bytes
-rw-r--r--screens/2014-05-25-123135_1366x768_scrot.pngbin0 -> 222077 bytes
-rw-r--r--screens/2014-05-25-224448_1366x768_scrot.pngbin0 -> 225992 bytes
-rw-r--r--src/kahn_pipe.ml26
-rw-r--r--src/primes.ml13
20 files changed, 19 insertions, 20 deletions
diff --git a/psr-SystemeReseaux-Projet.tar.gz b/psr-SystemeReseaux-Projet.tar.gz
new file mode 100644
index 0000000..525dc75
--- /dev/null
+++ b/psr-SystemeReseaux-Projet.tar.gz
Binary files differ
diff --git a/screens/2014-05-25-011028_1366x768_scrot.png b/screens/2014-05-25-011028_1366x768_scrot.png
new file mode 100644
index 0000000..3663ce3
--- /dev/null
+++ b/screens/2014-05-25-011028_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-011059_1366x768_scrot.png b/screens/2014-05-25-011059_1366x768_scrot.png
new file mode 100644
index 0000000..0f601d1
--- /dev/null
+++ b/screens/2014-05-25-011059_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-011138_1366x768_scrot.png b/screens/2014-05-25-011138_1366x768_scrot.png
new file mode 100644
index 0000000..e04ee64
--- /dev/null
+++ b/screens/2014-05-25-011138_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-011223_1366x768_scrot.png b/screens/2014-05-25-011223_1366x768_scrot.png
new file mode 100644
index 0000000..8d99b50
--- /dev/null
+++ b/screens/2014-05-25-011223_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-012431_1366x768_scrot.png b/screens/2014-05-25-012431_1366x768_scrot.png
new file mode 100644
index 0000000..7f36b31
--- /dev/null
+++ b/screens/2014-05-25-012431_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-012551_1366x768_scrot.png b/screens/2014-05-25-012551_1366x768_scrot.png
new file mode 100644
index 0000000..91b37b2
--- /dev/null
+++ b/screens/2014-05-25-012551_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-012814_1366x768_scrot.png b/screens/2014-05-25-012814_1366x768_scrot.png
new file mode 100644
index 0000000..9be7275
--- /dev/null
+++ b/screens/2014-05-25-012814_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-012903_1366x768_scrot.png b/screens/2014-05-25-012903_1366x768_scrot.png
new file mode 100644
index 0000000..27e53d6
--- /dev/null
+++ b/screens/2014-05-25-012903_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-012958_1366x768_scrot.png b/screens/2014-05-25-012958_1366x768_scrot.png
new file mode 100644
index 0000000..845e91d
--- /dev/null
+++ b/screens/2014-05-25-012958_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-013408_1366x768_scrot.png b/screens/2014-05-25-013408_1366x768_scrot.png
new file mode 100644
index 0000000..4110bfd
--- /dev/null
+++ b/screens/2014-05-25-013408_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-013506_1366x768_scrot.png b/screens/2014-05-25-013506_1366x768_scrot.png
new file mode 100644
index 0000000..2fd7e39
--- /dev/null
+++ b/screens/2014-05-25-013506_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-122207_1366x768_scrot.png b/screens/2014-05-25-122207_1366x768_scrot.png
new file mode 100644
index 0000000..b603873
--- /dev/null
+++ b/screens/2014-05-25-122207_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-122907_1366x768_scrot.png b/screens/2014-05-25-122907_1366x768_scrot.png
new file mode 100644
index 0000000..14878d8
--- /dev/null
+++ b/screens/2014-05-25-122907_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-123109_1366x768_scrot.png b/screens/2014-05-25-123109_1366x768_scrot.png
new file mode 100644
index 0000000..a4e5a8d
--- /dev/null
+++ b/screens/2014-05-25-123109_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-123122_1366x768_scrot.png b/screens/2014-05-25-123122_1366x768_scrot.png
new file mode 100644
index 0000000..f452230
--- /dev/null
+++ b/screens/2014-05-25-123122_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-123135_1366x768_scrot.png b/screens/2014-05-25-123135_1366x768_scrot.png
new file mode 100644
index 0000000..651b861
--- /dev/null
+++ b/screens/2014-05-25-123135_1366x768_scrot.png
Binary files differ
diff --git a/screens/2014-05-25-224448_1366x768_scrot.png b/screens/2014-05-25-224448_1366x768_scrot.png
new file mode 100644
index 0000000..0f53fa6
--- /dev/null
+++ b/screens/2014-05-25-224448_1366x768_scrot.png
Binary files differ
diff --git a/src/kahn_pipe.ml b/src/kahn_pipe.ml
index 2df8bc5..6e467ab 100644
--- a/src/kahn_pipe.ml
+++ b/src/kahn_pipe.ml
@@ -6,12 +6,11 @@ module Pipe: S = struct
type 'a in_port = in_channel
type 'a out_port = out_channel
- let new_channel =
- fun () ->
+ let new_channel () =
let i, o = Unix.pipe () in
Unix.in_channel_of_descr i, Unix.out_channel_of_descr o
- let get (c : 'a in_port) : 'a =
+ let get c =
fun () -> Marshal.from_channel c
let put x c =
@@ -60,17 +59,16 @@ module Pipe: S = struct
let doco l =
fun () ->
- let children =
- List.map
- (fun p ->
- match Unix.fork () with
- | 0 ->
- run p;
- exit 0
- | i -> i)
- l
- in
- List.iter
+ let launch p =
+ let pid = Unix.fork() in
+ if pid = 0 then begin
+ run p;
+ exit 0
+ end else
+ pid
+ in
+ let children = List.map launch l in
+ List.iter
(fun i -> try ignore(Unix.waitpid [] i) with _ -> ())
children
end
diff --git a/src/primes.ml b/src/primes.ml
index 6975b9e..c5a1831 100644
--- a/src/primes.ml
+++ b/src/primes.ml
@@ -28,20 +28,21 @@ module Primes (K : Kahn.S) = struct
(get qi) >>= (fun v ->
if v <> -1 then
begin
- K.output @@ Format.sprintf "%d@." v;
- (delay new_channel ()) >>=
- (fun (qi2, qo2) -> doco [ filter v qi qo2 ; primes qi2 ])
+ K.output (string_of_int v ^ "\n");
+ let qi2, qo2 = new_channel () in
+ doco [ filter v qi qo2 ; primes qi2 ]
end
else return ())
let main : int process =
- (delay new_channel ()) >>=
- (fun (q_in, q_out) -> doco [ integers 2000 q_out ; primes q_in ])
+ (return ()) >>=
+ (fun () -> let q_in, q_out = new_channel () in
+ doco [ integers 10000 q_out ; primes q_in ])
>>= (fun () -> return 42)
end
-module Eng = Kahn_seq.Seq
+module Eng = Kahn_pipe.Pipe
module P = Primes(Eng)
let () =