Version française
Home     About     Download     Resources     Contact us    
Browse thread
printf and fork question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael <micha-1@f...>
Subject: printf and fork question
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?

 Michael