unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Catching user interrupts
@ 2004-02-03 14:39 Andy Wingo
  2004-03-20 22:08 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Wingo @ 2004-02-03 14:39 UTC (permalink / raw)


Hi gang,

I'm running into trouble catching interrupts. It always works the first
time, but the second time I run a piece of code in the repl it becomes
unresponsive. For example:

(catch #t
       (lambda () (while #t #t))
       (lambda (key . args)
	 (if (not (eq? key 'signal))
	     (apply throw key args))))

Try that twice in your repl.

I've tried a lot more methods (sigaction throwing 'interrupt, sigaction
setting a system async to throw 'interrupt), but nothing works the
second time. Any clues? Thanks.
-- 
Andy Wingo <wingo@pobox.com>


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Catching user interrupts
  2004-02-03 14:39 Catching user interrupts Andy Wingo
@ 2004-03-20 22:08 ` Marius Vollmer
  0 siblings, 0 replies; 2+ messages in thread
From: Marius Vollmer @ 2004-03-20 22:08 UTC (permalink / raw)
  Cc: Guile Users

Andy Wingo <wingo@pobox.com> writes:

> I'm running into trouble catching interrupts. It always works the first
> time, but the second time I run a piece of code in the repl it becomes
> unresponsive. For example:
>
> (catch #t
>        (lambda () (while #t #t))
>        (lambda (key . args)
> 	 (if (not (eq? key 'signal))
> 	     (apply throw key args))))
>
> Try that twice in your repl.

Strange.  Try this variant

  (catch #t
         (lambda () (while #t #t))
         (lambda (key . args)
           (unmask-signals)                 ;;; <- this is new
 	   (if (not (eq? key 'signal))
 	     (apply throw key args))))

Somehow, signals end up being 'masked' after your code loop is
interrupted.  I haven't yet investigated why, tho.

This problem does not occur in 1.7, which has a quite different way to
handle signals internally.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-20 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-03 14:39 Catching user interrupts Andy Wingo
2004-03-20 22:08 ` Marius Vollmer

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 read-only IMAP folder(s) and NNTP newsgroup(s).