Browse thread
[Caml-list] different behaviour of Unix.fork on FreeBSD and Linux
-
Beck01, Wolfgang
- Remi Vanicat
- John Carr
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Remi Vanicat <vanicat@l...> |
| Subject: | Re: [Caml-list] different behaviour of Unix.fork on FreeBSD and Linux |
"Beck01, Wolfgang" <BeckW@t-systems.com> writes: [...] > open Printf > open Unix > > let ftst() = > let pid = fork() > in > if pid = 0 then > printf "son\n" > else begin > printf "father\n"; > let _= wait() > in > () > end > > let aa = > printf "test\n" > > let main() = > printf "main\n"; > ftst() > ;; [...] > > However, on Linux (OCaml 3.06), it is > > test > main > son > test <-- why? > main <-- why? > father it is a problem of bufferisation of the output made by printf. If you flush stdout before forking, there will be no problem. -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners