unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
	klaus.berndl@sdm.de
Subject: Re: while-no-input
Date: Tue, 30 Nov 2004 15:56:02 +0100	[thread overview]
Message-ID: <m3zn0ztmgt.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <E1CZ22W-0003pW-Li@fencepost.gnu.org> (Richard Stallman's message of "Tue, 30 Nov 2004 02:03:08 -0500")

Richard Stallman <rms@gnu.org> writes:

> So here's my simpler proposal for how to implement this.

I tried it -- but I don't have SYNC_INPUT defined, so I used this:

#define QUIT						\
  do {							\
    if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
      {							\
        Lisp_Object flag = Vquit_flag;			\
	Vquit_flag = Qnil;				\
	if (EQ (Vthrow_on_input, flag))			\
	  Fthrow (Vthrow_on_input, Qnil);		\
	Fsignal (Qquit, Qnil);				\
      }							\
  } while (0)


I then ran this code (in my normal emacs with cua-mode enabled):

(while-no-input
  (while t
    (prin1 "x")
    (sit-for 0)))

and hit space after a few seconds.  Got a crash:


Breakpoint 1, abort () at emacs.c:442

(gdb) xbacktrace
"cua--post-command-handler"
"run-hooks"
(gdb) bt
#0  abort () at emacs.c:442
#1  0x08182ae9 in Feval (form=140121845) at eval.c:2015
#2  0x081819e0 in Fcondition_case (args=145132605) at eval.c:1329
#3  0x081b7204 in Fbyte_code (bytestr=144710763, vector=144806556, maxdepth=24) at bytecode.c:864
#4  0x08184383 in funcall_lambda (fun=144661804, nargs=0, arg_vector=0xbfffd608) at eval.c:2959
#5  0x08183dcb in Ffuncall (nargs=1, args=0xbfffd604) at eval.c:2820
#6  0x081836c8 in run_hook_with_args (nargs=1, args=0xbfffd604, cond=to_completion) at eval.c:2440
#7  0x081834bc in Frun_hooks (nargs=1, args=0xbfffd6d4) at eval.c:2308
#8  0x08183b46 in Ffuncall (nargs=2, args=0xbfffd6d0) at eval.c:2753
#9  0x0818386b in call1 (fn=137798905, arg1=137754665) at eval.c:2566
#10 0x0810cf01 in safe_run_hooks_1 (hook=0) at keyboard.c:2034
#11 0x08181b06 in internal_condition_case (bfun=0x810cee7 <safe_run_hooks_1>, handlers=137698537, hfun=0x810cf06 <safe_run_hooks_error>) at eval.c:1382
#12 0x0810cf9c in safe_run_hooks (hook=137754665) at keyboard.c:2062
#13 0x0810c25b in command_loop_1 () at keyboard.c:1801
#14 0x08181b06 in internal_condition_case (bfun=0x810adbb <command_loop_1>, handlers=137764305, hfun=0x810a900 <cmd_error>) at eval.c:1382
#15 0x0810ac33 in command_loop_2 () at keyboard.c:1309
#16 0x081815cc in internal_catch (tag=137756753, func=0x810ac14 <command_loop_2>, arg=137698489) at eval.c:1143
#17 0x0810abe6 in command_loop () at keyboard.c:1288
#18 0x0810a67f in recursive_edit_1 () at keyboard.c:981
#19 0x0810a7c0 in Frecursive_edit () at keyboard.c:1042
#20 0x0810911b in main (argc=3, argv=0xbfffdf04) at emacs.c:1742
#21 0x42015574 in __libc_start_main () from /lib/tls/libc.so.6
(gdb) p handling_signal
$1 = 1
(gdb) p interrupt_input_blocked
$2 = 0
(gdb) 

Seems that we can break out of XTread_socket without restoring
handling_signal.

I don't know if it is sufficient to unwind protect it.


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2004-11-30 14:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-26  9:26 AW: vc-state always calls heuristic function klaus.berndl
2004-11-26 11:44 ` Kim F. Storm
2004-11-27 18:51   ` while-no-input Richard Stallman
2004-11-27 23:03     ` while-no-input Kim F. Storm
2004-11-29  6:11       ` while-no-input Richard Stallman
2004-11-29 14:20         ` while-no-input Stefan Monnier
2004-11-30  7:03           ` while-no-input Richard Stallman
2004-11-30 14:56             ` Kim F. Storm [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-29 15:02 while-no-input klaus.berndl
2004-11-29 14:30 while-no-input klaus.berndl
2004-11-29 14:55 ` while-no-input Stefan Monnier
2002-10-01 21:19 while-no-input Stefan Monnier
2002-10-02 19:24 ` while-no-input Richard Stallman
2002-10-02 21:43   ` while-no-input Stefan Monnier
2002-10-03 13:28     ` while-no-input Richard Stallman
2002-10-03 15:53       ` while-no-input Stefan Monnier
2002-10-03 22:44         ` while-no-input Kim F. Storm
2002-10-03 22:33           ` while-no-input Stefan Monnier
2002-10-04 15:46         ` while-no-input Richard Stallman
2002-10-04 15:59           ` while-no-input Stefan Monnier
2002-10-05 16:33             ` while-no-input Richard Stallman
2002-10-24  0:06             ` while-no-input Kim F. Storm
2002-10-24  7:20               ` while-no-input Stefan Monnier
2002-10-24 10:24                 ` while-no-input Kim F. Storm
2002-10-25  5:35                   ` while-no-input Richard Stallman
2002-10-25  9:19                     ` while-no-input Kim F. Storm
2002-10-26 20:15                       ` while-no-input Richard Stallman
2002-10-25 13:44                     ` while-no-input Stefan Monnier
2002-10-26 20:13                       ` while-no-input Richard Stallman
2002-10-29 19:45                         ` while-no-input Stefan Monnier
2002-10-31 17:25                           ` while-no-input Richard Stallman
2002-10-31 18:03                             ` while-no-input Stefan Monnier
2002-11-02  3:32                               ` while-no-input Richard Stallman
2002-10-05 22:43       ` while-no-input Kim F. Storm

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m3zn0ztmgt.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --cc=klaus.berndl@sdm.de \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).