Browse thread
printf and fork question
-
Michael
- Gerd Stolpmann
- Basile STARYNKEVITCH
- David Fox
- Olivier Andrieu
- Michael
[
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: | Olivier Andrieu <andrieu@i...> |
| Subject: | Re: [Caml-list] printf and fork question |
> Michael [Mon, 7 Mar 2005]: > Hi, > > I don't understand why this: > > open Unix;; > let _ = > Printf.printf "Hi! %d\n" (getpid()); > match fork() with > | 0 -> if fork() <> 0 then exit 0; > () > | id -> ignore (waitpid [] id) > > prints out that: > Hi! 12215 > Hi! 12215 > Hi! 12215 > > > with ocaml 3.08.2. Any hints? You haven't flushed stdout : so the Hi! stays in the buffer and the children inherit it. -- Olivier