git.annexia.org
/
mclu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add TODO list.
[mclu.git]
/
parallel.ml
diff --git
a/parallel.ml
b/parallel.ml
index
086611e
..
1bb9897
100644
(file)
--- a/
parallel.ml
+++ b/
parallel.ml
@@
-21,6
+21,9
@@
open Printf
open Unix
open Printf
open Unix
+(* Call _exit directly, ie. do not run OCaml atexit handlers. *)
+external _exit : int -> 'a = "parallel_exit" "noalloc"
+
let map f xs =
let xs = List.map (
fun x ->
let map f xs =
let xs = List.map (
fun x ->
@@
-35,8
+38,10
@@
let map f xs =
close rfd;
let y = Printexc.catch f x in
(* Write the final value to the pipe. *)
close rfd;
let y = Printexc.catch f x in
(* Write the final value to the pipe. *)
- output_value (out_channel_of_descr wfd) y;
- exit 0
+ let chan = out_channel_of_descr wfd in
+ output_value chan y;
+ flush chan;
+ _exit 0
| pid -> (* parent *)
close wfd;
| pid -> (* parent *)
close wfd;