public inbox for
 help / color / mirror / Atom feed
From: Keisuke Nishida <>
Subject: Re: interrupting the Scheme process
Date: Sat, 06 May 2000 08:00:00 -0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Ken Raeburn <> writes:

> Guile has some hooks for recording that an interrupt has occurred and,
> at certain times, throwing an exception of some sort.  If we could set
> that flag at C-g time, if Scheme code is currently running, might that
> do the trick?  Then Scheme can trap the exception if it wants, but
> otherwise we throw back to the containing Lisp call.  Propagating the
> unwind through possibly multiple lisp<->scheme interfaces could be
> hairy though; I haven't looked very closely at that stuff.

It seems Emacs catches the interrupt by interrupt_signal in keyboard.c,
so we could modify this function so that it also sets the Guile's flag.
If this works, we can convert the signal from Guile into a Emacs's quit
signal.  In case this doesn't work, I don't know what to do.

/* This routine is called at interrupt level in response to C-G.
 If interrupt_input, this is the handler for SIGINT.
 Otherwise, it is called from kbd_buffer_store_event,
 in handling SIGIO or SIGTINT.

 If `waiting_for_input' is non zero, then unless `echoing' is nonzero,
 immediately throw back to read_char.

 Otherwise it sets the Lisp variable  quit-flag  not-nil.
 This causes  eval  to throw, when it gets a chance.
 If  quit-flag  is already non-nil, it stops the job right away.  */

interrupt_signal (signalnum)	/* If we don't have an argument, */
     int signalnum;		/* some compilers complain in signal calls. */

> Hm...that might be a way to do it.  I also wonder if we might have
> cases where we want to send the interrupt to multiple threads -- i.e.,
> if the "foreground" thread is sitting around waiting for N tasks to
> finish (e.g., get new news from, get email from
>, get new news from, etc), might we
> want to interrupt all of them and unwind the main thread only after
> they've died off?

Probably.  We should kill the parent thread and its children at the same
time, though I guess we would still need kill-thread to kill detached
threads, which are "background" threads.  We don't want to close a GTK
window, which may run in a separate thread, just by typing C-g, for example.

> I suppose we could have a "spawn and wait for multiple threads"
> function which implements all of this on top of the scheme^Wplan you
> describe, by trapping the interrupt...

Anyway, we can't work on this until your Guile-based Emacs appears :)

-- Kei

  reply	other threads:[~2000-05-06  8:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-03  4:52 scheme directory Satoru Takabayashi
2000-05-03 12:15 ` Kalle Olavi Niemitalo
2000-05-05 11:56   ` Ken Raeburn
2000-05-03 15:03 ` interrupting the Scheme process Keisuke Nishida
2000-05-04 10:21   ` Kalle Olavi Niemitalo
2000-05-05 12:08   ` Ken Raeburn
2000-05-06  8:00     ` Keisuke Nishida [this message]
2000-05-06 10:34       ` Ken Raeburn

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

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