caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <gerd@gerd-stolpmann.de>
To: Michael <micha-1@fantasymail.de>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] printf and fork question
Date: Mon, 07 Mar 2005 14:57:55 +0100	[thread overview]
Message-ID: <1110203875.5829.1.camel@localhost.localdomain> (raw)
In-Reply-To: <20050307144422.1e67bef6.micha-1@fantasymail.de>

Am Montag, den 07.03.2005, 14:44 +0100 schrieb Michael:
> 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

You have three copies of the stdout buffer. Call "flush stdout" after
printf.

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
------------------------------------------------------------



  reply	other threads:[~2005-03-07 13:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-07 13:44 Michael
2005-03-07 13:57 ` Gerd Stolpmann [this message]
2005-03-07 14:03 ` [Caml-list] " Basile STARYNKEVITCH
2005-03-07 14:05 ` David Fox
2005-03-07 14:10 ` Olivier Andrieu
     [not found] ` <6b8a9142050307060758200ad3@mail.gmail.com>
2005-03-07 14:12   ` Michael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1110203875.5829.1.camel@localhost.localdomain \
    --to=gerd@gerd-stolpmann.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=micha-1@fantasymail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).