From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA14728 for caml-redistribution; Tue, 26 Jan 1999 18:45:35 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA24338 for ; Tue, 26 Jan 1999 12:26:35 +0100 (MET) Received: from batman.npl.co.uk (batman.npl.co.uk [139.143.5.1]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id MAA19195 for ; Tue, 26 Jan 1999 12:26:31 +0100 (MET) Received: from herschel.npl.co.uk ([139.143.1.16]) by batman.npl.co.uk (8.9.1/8.9.1) with ESMTP id LAA04230; Tue, 26 Jan 1999 11:26:18 GMT Received: from squall.cise.npl.co.uk (squall.cise.npl.co.uk [139.143.18.3]) by herschel.npl.co.uk (8.8.5/8.8.5) with ESMTP id LAA12693; Tue, 26 Jan 1999 11:26:16 GMT Received: (from tm1@localhost) by squall.cise.npl.co.uk (8.8.8/8.8.8) id LAA07404; Tue, 26 Jan 1999 11:23:51 GMT Date: Tue, 26 Jan 1999 11:23:51 GMT From: Toby Moth Message-Id: <199901261123.LAA07404@squall.cise.npl.co.uk> To: caml-list@inria.fr, itz@transbay.net Subject: Re: Catching Break? X-Sun-Charset: US-ASCII Sender: weis Ian T Zimmerman writes: > > 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? On the other hand - if one hard-codes in a value for sigint.. let interrupt_handle _ = prerr_endline "Caught C-c"; exit 0;; Sys.set_signal 2 ( Sys.Signal_handle interrupt_handle ); print_string "You have 10 seconds to stop me with C-c"; print_newline (); Unix.sleep 10; print_endline "You failed." then everything works perfectly. I don't understand why there is a discrepancy between the interrupt numbers in sys.ml and those in /usr/include/sys/signal.h ? On the other hand, I know next to nothing about these sorts of things. Toby