caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Toby Moth <tm1@cise.npl.co.uk>
To: caml-list@inria.fr, itz@transbay.net
Subject: Re: Catching Break?
Date: Tue, 26 Jan 1999 11:23:51 GMT	[thread overview]
Message-ID: <199901261123.LAA07404@squall.cise.npl.co.uk> (raw)

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




             reply	other threads:[~1999-01-26 17:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-26 11:23 Toby Moth [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-01-26  5:17 Frank A. Christoph
1999-01-25 18:43 Ian T Zimmerman
1999-01-26  0:24 ` Xavier Leroy
1999-01-26  6:46   ` Ian T Zimmerman
1999-01-28 11:14     ` Xavier Leroy
1999-01-28 17:33       ` Ian T Zimmerman
1999-02-06  8:24         ` Ian T Zimmerman
1999-02-09  7:02           ` Ian T Zimmerman
1999-02-10 15:48             ` Xavier Leroy
1999-02-05 18:00   ` Ian T Zimmerman
1999-02-08 17:16     ` Xavier Leroy

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=199901261123.LAA07404@squall.cise.npl.co.uk \
    --to=tm1@cise.npl.co.uk \
    --cc=caml-list@inria.fr \
    --cc=itz@transbay.net \
    /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).