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 MAA13227; Sun, 8 Sep 2002 12:30:43 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA13006 for ; Sun, 8 Sep 2002 12:30:42 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from mail.fltrp.com ([211.101.185.130]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g88AUd126050 for ; Sun, 8 Sep 2002 12:30:40 +0200 (MET DST) Received: from fltrp.com [129.0.5.6] by mail.fltrp.com with ESMTP (SMTPD32-7.12 EVAL) id A68077C00EA; Sun, 08 Sep 2002 18:29:20 +0800 Message-ID: <3D7B267E.8040101@fltrp.com> Date: Sun, 08 Sep 2002 18:29:18 +0800 From: Yang Shouxun User-Agent: Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3 X-Accept-Language: en-us, zh-cn MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Unix.wait: strange behavior Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I'm reading ocaml-book English version. On p. 611: ----8<---- match Unix.fork () with 0 -> Printf.printf "fair Marquise " ; flush stdout | _ -> ignore (Unix.wait ()) ; match Unix.fork () with 0 -> Printf.printf "your beautiful eyes " ; flush stdout | _ -> ignore (Unix.wait ()) ; match Unix.fork () with 0 -> Printf.printf "make me die " ; flush stdout | _ -> ignore (Unix.wait ()) ; Printf.printf "of love\n" ; flush stdout ----8<---- this is intended to show the use of Unix.wait to wait for the termination of the child. Strangely, when I input at the Ocaml toplevel, it does not print "fair Marquise your beautiful eyes make me die of love", but only "fair Marquise". The forked processes did not terminate for some reason, which I don't understand why. Is this a bug? Guessing that the child processes will not automatically exit, I added "; exit 0" to the lines for newly forked processes, and I got "your beautiful eyes make me die of love" printed before the return of the expression and then "fair Marquise " printed. ------------------- 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