boot: Stop hard-coding the bridge name.
[mclu.git] / parallel.ml
index 086611e..1bb9897 100644 (file)
@@ -21,6 +21,9 @@
 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 ->
@@ -35,8 +38,10 @@ let map f xs =
         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;