Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Why ii is not different from 0 ? *)
- let ii = ref 0;;
- let foo () =
- for i=0 to 100000000 do
- incr ii
- done
- ;;
- let bar () =
- for i=0 to 3 do
- match Unix.fork () with
- | 0 ->
- begin
- foo ();
- exit 0;
- end
- | -1 -> failwith "fork"
- | _ -> ()
- done;
- for i=0 to 3 do ignore (Unix.wait ()) done;
- print_endline (string_of_int !ii)
- ;;
- bar ();;
Advertisement
Add Comment
Please, Sign In to add comment