From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA00724; Mon, 19 May 2003 12:03:42 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA06799 for ; Mon, 19 May 2003 12:03:41 +0200 (MET DST) Received: from mwinf0501.wanadoo.fr (smtp4.wanadoo.fr [193.252.22.26]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h4JA3eT24567 for ; Mon, 19 May 2003 12:03:40 +0200 (MET DST) Received: from debian (unknown [80.8.88.184]) by mwinf0501.wanadoo.fr (SMTP Server) with ESMTP id ABDE84002F0 for ; Mon, 19 May 2003 12:03:40 +0200 (CEST) Received: from moi by debian with local (Exim 3.36 #1 (Debian)) id 19HhUa-0000RJ-00 for ; Mon, 19 May 2003 12:03:40 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] different behaviour of Unix.fork on FreeBSD and Linux Mail-Copy-To: never From: Remi Vanicat Date: Mon, 19 May 2003 12:03:40 +0200 In-Reply-To: ("Beck01, Wolfgang"'s message of "Mon, 19 May 2003 11:35:59 +0200") Message-ID: <871xyvs16r.dlv@wanadoo.fr> User-Agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.3 References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; caml-list:01 fork:01 t-systems:01 printf:01 3.06:01 stdout:01 forking:01 ocaml:01 flush:01 behaviour:01 dept-info:01 labri:01 u-bordeaux:01 writes:01 remi:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk "Beck01, Wolfgang" 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