Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Catching Break?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frank A. Christoph <christo@n...>
Subject: Re: Catching Break?
>Why doesn't this work:
>
>let main() =
>  Sys.catch_break true;
>  try Unix.kill (Unix.getpid()) Sys.sigint
>  with Sys.Break -> prerr_endline "CAUGHT!"; exit 0
>
>let _ = main()
>
>This program just prints "Fatal error: Uncaught exception Sys.Break"
>as if the try block weren't there.  Am I overlooking something really
>obvious?
>
>Ocaml 2.01, Unix (Linux 2.0), libc5, linuxthreads.

Bytecode or native?  For the native compiler, chapter 10.4 of the manual says:

  Signals are detected only when the program performs an allocation
  in the heap.  That is, if a signal is delivered while in a piece of
  code that does not allocate, its handler will not be called until
  the next heap allocation.

--FC