annotate src/signal.c @ 1318:b531bf8658e9

[xemacs-hg @ 2003-02-21 06:56:46 by ben] redisplay fixes et al. PROBLEMS: Add comment about Cygwin, unexec and sysmalloc. Move some non-general stuff out of general. Make a section for x86. configure.in: Add check for broken alloca in funcalls. mule/mule-cmds.el: Alias file-name to native not vice-versa. Do set EOL of native but not of process output to fix various problems and be consistent with code-init.el. code-cmds.el: Return a name not a coding system. code-init.el: Reindent. Remove `file-name' since it should always be the same as native. unicode.el: Rename to load-unicode-mapping-table as suggested by the anonymous (but rather Turnbullian) comment in unicode.c. xemacs.dsp: Add /k to default build. alloc.c: Make gc_currently_forbidden static. config.h.in, lisp.h: Move some stuff to lisp.h. console-gtk.h, console-impl.h, console-msw.h, console-x.h, event-Xt.c, event-msw.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, gtk-xemacs.c: Remove duplicated code to redraw exposed area. Add deadbox method needed by the generalized redraw code. Defer redrawing if already in redisplay. frame-msw.c, event-stream.c, frame.c: Add comments about calling Lisp. debug.c, general-slots.h: Move generalish symbols to general-slots.h. doprnt.c: reindent. lisp.h, dynarr.c: Add debug code for locking a dynarr to catch invalid mods. Use in redisplay.c. eval.c: file-coding.c: Define file-name as alias for native not vice-versa. frame-gtk.c, frame-x.c: Move Qwindow_id to general-slots. dialog-msw.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, gui.c, gui.h, menubar-msw.c, menubar.c: Ensure that various glyph functions that eval within redisplay protect the evals. Same for calls to internal_equal(). Modify various functions, e.g. gui_item_*(), to protect evals within redisplay, taking an in_redisplay parameter if it's possible for them to be called both inside and outside of redisplay. gutter.c: Defer specifier-changed updating till after redisplay, if necessary, since we need to enter redisplay to do it. gutter.c: Do nothing if in redisplay. lisp.h: Add version of alloca() for use in function calls. lisp.h: Add XCAD[D+]R up to 6 D's, and aliases X1ST, X2ND, etc. frame.c, frame.h, redisplay.c, redisplay.h, signal.c, toolbar.c: Redo critical-section code and move from frame.c to redisplay.c. Require that every place inside of redisplay catch errors itself, not at the edge of the critical section (thereby bypassing the rest of redisplay and leaving things in an inconsistent state). Introduce separate means of holding frame-size changes without entering a complete critical section. Introduce "post-redisplay" methods for deferring things till after redisplay. Abort if we enter redisplay reentrantly. Disable all quit checking in redisplay since it's too dangerous. Ensure that all calls to QUIT trigger an abort if unprotected. redisplay.c, scrollbar-gtk.c, scrollbar-x.c, scrollbar.c: Create enter/exit_redisplay_critical_section_maybe() for code that needs to ensure it's in a critical section but doesn't interfere with an existing critical section. sysdep.c: Use _wexecve() when under Windows NT for Unicode correctness. text.c, text.h: Add new_dfc() functions, which return an alloca()ed value rather than requiring an lvalue. (Not really used yet; used in another workspace, to come.) Add some macros for SIZED_EXTERNAL. Update the encoding aliases after involved scrutinization of the X manual. unicode.c: Answer the anonymous but suspiciously Turnbullian questions. Rename parse-unicode-translation-table to load-unicode-mapping-table, as suggested.
author ben
date Fri, 21 Feb 2003 06:57:21 +0000
parents 70921960b980
children 51e4a77ed447
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Handling asynchronous signals.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
3 Copyright (C) 1995, 1996, 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not synched with FSF. Split out of keyboard.c. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "console.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
28 #include "device-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "events.h" /* for signal_fake_event() */
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
30 #include "frame-impl.h"
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
31 #include "process.h"
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
32
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "sysdep.h"
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
34 #include "sysfile.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "syssignal.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "systime.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 /* Set to 1 when a quit-check signal (either a SIGIO interrupt or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 the asynch. timeout for poll-for-quit) occurs. The QUITP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 macro may look at this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 volatile int quit_check_signal_happened;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 /* Count of the number of times a quit-check signal has occurred.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Some stuff in event-Xt.c looks at this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 volatile int quit_check_signal_tick_count;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 /* Set to 1 when a SIGINT (or SIGQUIT) interrupt is processed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 maybe_read_quit_event() looks at this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 volatile int sigint_happened;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 /* Set to 1 when an asynch. timeout signal occurs. */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
52 static volatile int async_timeout_happened;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
53
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
54 /* Set to 1 when a multiple of SLOWED_DOWN_INTERRUPTS_SECS elapses,
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
55 after slow_down_interrupts() is called. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
56 static volatile int slowed_interrupt_timeout_happened;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 /* This is used to synchronize setting the waiting_for_user_input_p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 flag. */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
60 static volatile int async_timeout_happened_while_emacs_was_blocking;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 /* See check_quit() for when this is set. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 int dont_check_for_quit;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
65 static int poll_for_quit_id;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
66 static int poll_for_sigchld_id;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 /* This variable is used to communicate to a lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 process-filter/sentinel/asynchronous callback (via the function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 Fwaiting_for_user_input_p below) whether XEmacs was waiting for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 user-input when that process-filter was called. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 static int waiting_for_user_input_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 static int interrupts_slowed_down;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 #define SLOWED_DOWN_INTERRUPTS_SECS 15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 #define NORMAL_QUIT_CHECK_TIMEOUT_MSECS 250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 #define NORMAL_SIGCHLD_CHECK_TIMEOUT_MSECS 250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 /* Used so that signals can break out of system calls that aren't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 naturally interruptible. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 JMP_BUF break_system_call_jump;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 volatile int can_break_system_calls;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
86 static SIGTYPE alarm_signal (int signo);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
87
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
88
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 /**********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 /* Asynchronous timeout functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 /**********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
94 /* See the comment in event-stream.c, under major heading "Timeouts",
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
95 for the difference between low-level (one-shot) and high-level
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
96 (periodic/resignaling) timeouts. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
97
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 /* The pending timers are stored in an ordered list, where the first timer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 on the list is the first one to fire. Times recorded here are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 absolute. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 static struct low_level_timeout *async_timer_queue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 /* Nonzero means async timers are temporarily suppressed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 static int async_timer_suppress_count;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 set_one_shot_timer (EMACS_TIME interval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #ifdef HAVE_SETITIMER
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 struct itimerval it;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 it.it_value = interval;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 EMACS_SET_SECS_USECS (it.it_interval, 0, 0);
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
113 qxe_setitimer (ITIMER_REAL, &it, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 int secs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 EMACS_TIME_TO_INT (interval, secs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 alarm (secs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 reset_interval_timer (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 EMACS_TIME interval;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 /* Get the interval to set. If an interval is available,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 make sure it's not zero (this is a valid return, but it will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 cause the timer to get disabled, so convert it to a very short
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 time). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 if (get_low_level_timeout_interval (async_timer_queue, &interval))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 if (EMACS_SECS (interval) == 0 && EMACS_USECS (interval) == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 EMACS_SET_USECS (interval, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 /* A time of 0 means "disable". */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 EMACS_SET_SECS_USECS (interval, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 set_one_shot_timer (interval);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 init_async_timeouts (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 {
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
146 set_timeout_signal (SIGALRM, alarm_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 async_timer_suppress_count = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 /* Turn off async timeouts. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 stop_async_timeouts (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 if (async_timer_suppress_count == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 /* If timer was on, turn it off. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 EMACS_TIME thyme;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 EMACS_SET_SECS_USECS (thyme, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 set_one_shot_timer (thyme);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 async_timer_suppress_count++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 /* Turn on async timeouts again. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 start_async_timeouts (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 assert (async_timer_suppress_count > 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 async_timer_suppress_count--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 if (async_timer_suppress_count == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 /* Some callers turn off async timeouts and then use the alarm
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 for their own purposes; so reinitialize everything. */
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
176 set_timeout_signal (SIGALRM, alarm_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 reset_interval_timer ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
181 static void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
182 handle_async_timeout_signal (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 {
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
184 int interval_id;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
185 int wakeup_id;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
186 Lisp_Object fun, arg;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
187 /* Avoid any possibility of GC during QUIT */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
188 int specco = begin_gc_forbidden ();
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
189
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
190 /* No checks for Vinhibit_quit here or anywhere else in this file!!!
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
191 Otherwise critical quit will not work right.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
192 The only check for Vinhibit_quit is in QUIT itself.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
193
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
194 (#### ???? I don't quite understand this comment.) */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
195 interval_id = pop_low_level_timeout (&async_timer_queue, 0);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
196
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
197 reset_interval_timer ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
198 if (async_timeout_happened_while_emacs_was_blocking)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
199 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
200 async_timeout_happened_while_emacs_was_blocking = 0;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
201 waiting_for_user_input_p = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
202 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
203
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
204 wakeup_id = event_stream_resignal_wakeup (interval_id, 1, &fun, &arg);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
206 if (wakeup_id == poll_for_quit_id)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
207 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
208 quit_check_signal_happened = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
209 quit_check_signal_tick_count++;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
210 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
211 else if (wakeup_id == poll_for_sigchld_id)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 {
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
213 kick_status_notify ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 }
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
215 else
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
216 /* call1 GC-protects its arguments */
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
217 call1_trapping_problems ("Error in asynchronous timeout callback",
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
218 fun, arg, INHIBIT_GC);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
219
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
220 waiting_for_user_input_p = 0;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
221
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
222 unbind_to (specco);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
223 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
224
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
225 /* The following two functions are the external interface onto
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
226 creating/deleting asynchronous interval timeouts, and are
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
227 called by event-stream.c. We call back to event-stream.c using
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
228 event_stream_resignal_wakeup(), when an interval goes off. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
229
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
230 int
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
231 signal_add_async_interval_timeout (EMACS_TIME thyme)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
232 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
233 int id = add_low_level_timeout (&async_timer_queue, thyme);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
234
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
235 /* If this timeout is at the head of the queue, then we need to
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
236 set the timer right now for this timeout. Otherwise, things
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
237 are fine as-is; after the timers ahead of us are signalled,
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
238 the timer will be set for us. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
239
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
240 if (async_timer_queue->id == id)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
241 reset_interval_timer ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
242
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
243 return id;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 void
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
247 signal_remove_async_interval_timeout (int id)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 {
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
249 int first = (async_timer_queue && async_timer_queue->id == id);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
250 remove_low_level_timeout (&async_timer_queue, id);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
251
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
252 /* If we removed the timeout from the head of the queue, then
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
253 we need to reset the interval timer right now. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
254 if (first)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
255 reset_interval_timer ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
258 /* If alarm() gets called when polling isn't disabled, it will mess up
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
259 the asynchronous timeouts, and then C-g checking won't work again.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
260 Some libraries call alarm() directly, so we override the standard
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
261 library's alarm() and abort() if the caller of the library function
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
262 didn't wrap in stop_interrupts()/start_interrupts().
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
264 NOTE: We could potentially avoid the need to wrap by adding a
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
265 one-shot timeout to simulate the alarm(), smashing our signal
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
266 handler back into place, and calling the library function when the
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
267 alarm goes off. But do we want to? We're not going to gain the
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
268 ability to C-g out of library functions this way (unless we forcibly
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
269 longjmp() out of a signal handler, which is likely to lead to a
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
270 crash). --ben */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 #ifdef HAVE_SETITIMER
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
273
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 unsigned int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 alarm (unsigned int howlong)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 struct itimerval old_it, new_it;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 assert (async_timer_suppress_count > 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 new_it.it_value.tv_sec = howlong;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 new_it.it_value.tv_usec = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 new_it.it_interval.tv_sec = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 new_it.it_interval.tv_usec = 0;
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
285 qxe_setitimer (ITIMER_REAL, &new_it, &old_it);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 /* Never return zero if there was a timer outstanding. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 return old_it.it_value.tv_sec + (old_it.it_value.tv_usec > 0 ? 1 : 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 }
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
290
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
291 int
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
292 qxe_setitimer (int kind, const struct itimerval *itnew,
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
293 struct itimerval *itold)
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
294 {
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 1123
diff changeset
295 #ifdef WIN32_ANY
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
296 /* setitimer() does not exist on native MS Windows, and appears broken
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
297 on Cygwin. See win32.c.
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
298
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
299 We are emulating the Unix98 setitimer() function, as found in its
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
300 incarnations on modern versions of Unix. Note however that in
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
301 the win32.c version, ITNEW and ITOLD must be equal if both are
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
302 non-zero, due to limitations in the underlying multimedia-timer
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
303 API. */
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
304 return mswindows_setitimer (kind, itnew, itold);
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
305 #else
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
306 /* YUCK! glibc defines setitimer's first argument as
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
307 enum __itimer_which, not int, which causes compile errors if
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
308 we call setitimer() in the obvious way. */
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
309 switch (kind)
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
310 {
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
311 case ITIMER_REAL: return setitimer (ITIMER_REAL, itnew, itold);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
312 case ITIMER_VIRTUAL: return setitimer (ITIMER_VIRTUAL, itnew, itold);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
313 case ITIMER_PROF: return setitimer (ITIMER_PROF, itnew, itold);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
314 default: abort (); return 0;
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 613
diff changeset
315 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 #endif
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
317 }
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
318
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
319 #endif /* HAVE_SETITIMER */
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 593
diff changeset
320
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
321 signal_handler_t
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
322 set_timeout_signal (int signal_number, signal_handler_t action)
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
323 {
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
324 #ifdef CYGWIN_BROKEN_SIGNALS
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
325 return mswindows_sigset (signal_number, action);
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
326 #else
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
327 return EMACS_SIGNAL (signal_number, action);
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
328 #endif
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
329 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, 0, 0, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 Return non-nil if XEmacs is waiting for input from the user.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 This is intended for use by asynchronous timeout callbacks and by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 asynchronous process output filters and sentinels (not yet implemented
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 in XEmacs). It will always be nil if XEmacs is not inside of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 an asynchronous timeout or process callback.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 return waiting_for_user_input_p ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 /**********************************************************************/
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
345 /* Enabling/disabling signals */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
346 /**********************************************************************/
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
347
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
348 static int interrupts_initted;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
349
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
350 void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
351 stop_interrupts (void)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
352 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
353 if (!interrupts_initted)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
354 return;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
355 #if defined(SIGIO) && !defined(BROKEN_SIGIO)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
356 unrequest_sigio ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
357 #endif
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
358 stop_async_timeouts ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
359 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
360
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
361 void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
362 start_interrupts (void)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
363 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
364 if (!interrupts_initted)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
365 return;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
366 #if defined(SIGIO) && !defined(BROKEN_SIGIO)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
367 request_sigio ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
368 #endif
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
369 start_async_timeouts ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
370 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
371
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
372
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
373 static void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
374 establish_slow_interrupt_timer (void)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
375 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
376 EMACS_TIME thyme;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
377
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
378 EMACS_SET_SECS_USECS (thyme, SLOWED_DOWN_INTERRUPTS_SECS, 0);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
379 set_one_shot_timer (thyme);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
380 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
381
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
382 /* Some functions don't like being interrupted with SIGALRM or SIGIO.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
383 Previously we were calling stop_interrupts() / start_interrupts(),
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
384 but then if the program hangs in one of those functions, e.g.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
385 waiting for a connect(), we're really screwed. So instead we
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
386 just "slow them down". We do this by disabling all interrupts
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
387 and then installing a timer of length fairly large, like 5 or
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
388 10 secs. That way, any "legitimate" connections (which should
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
389 take a fairly short amount of time) go through OK, but we can
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
390 interrupt bogus ones. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
391
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
392 void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
393 slow_down_interrupts (void)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
394 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
395 /* We have to set the flag *before* setting the slowed-down timer,
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
396 to avoid a race condition -- if the signal occurs between the
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
397 call to set_one_shot_timer() and the setting of this flag,
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
398 async_timeout_happened will get set, which will be a Bad Thing if
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
399 there were no timeouts on the queue. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
400 interrupts_slowed_down++;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
401 if (interrupts_slowed_down == 1)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
402 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
403 stop_interrupts ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
404 establish_slow_interrupt_timer ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
405 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
406 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
407
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
408 void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
409 speed_up_interrupts (void)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
410 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
411 if (interrupts_slowed_down > 0)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
412 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
413 start_interrupts ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
414 /* Change this flag AFTER fiddling with interrupts, for the same
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
415 race-condition reasons as above. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
416 interrupts_slowed_down--;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
417 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
418 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
419
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
420
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
421 /**********************************************************************/
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
422 /* The mechanism that drives it all */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 /**********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
425 /* called from QUIT when something_happened gets set (as a result of
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
426 a signal) */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
427
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
428 void
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
429 check_what_happened (void)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
430 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
431 /* No GC can happen anywhere here. handle_async_timeout_signal()
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
432 prevents GC (from asynch timeout handler), so does check_quit()
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
433 (from processing a message such as WM_INITMENU as a result of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
434 draining the message queue). establish_slow_interrupt_timer() is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
435 too low-level to do anything that might invoke QUIT or call Lisp
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
436 code. */
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
437
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
438 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
439 assert_with_message
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
440 (proper_redisplay_wrapping_in_place (),
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
441 "QUIT called from within redisplay without being properly wrapped");
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
442
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
443 /* When in a critical section, don't reset something_happened, so that
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
444 every single QUIT will verify proper wrapping. (something_happened
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
445 was set by enter_redisplay_critical_section() and will be reset
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
446 upon exit.) */
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
447 if (!in_display)
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
448 #endif
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
449 something_happened = 0;
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1315
diff changeset
450
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
451 if (async_timeout_happened)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
452 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
453 async_timeout_happened = 0;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
454 handle_async_timeout_signal ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
455 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
456 if (slowed_interrupt_timeout_happened)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
457 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
458 slowed_interrupt_timeout_happened = 0;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
459 establish_slow_interrupt_timer ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
460 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
461
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
462 check_quit ();
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
463 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
464
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
465 #ifdef SIGIO
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
466
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
467 /* Signal handler for SIGIO. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
468
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
469 static void
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
470 input_available_signal (int signo)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
471 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
472 something_happened = 1; /* tell QUIT to wake up */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
473 quit_check_signal_happened = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
474 quit_check_signal_tick_count++;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
475 EMACS_REESTABLISH_SIGNAL (signo, input_available_signal);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
476 SIGRETURN;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
477 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
478
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
479 #endif /* SIGIO */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
480
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
481 /* Actual signal handler for SIGALRM. Called when:
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
482
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
483 -- asynchronous timeouts (added with `add-async-timeout') go off
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
484
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
485 -- when the poll-for-quit timer (used for C-g handling; more or
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
486 less when SIGIO is unavailable or BROKEN_SIGIO is defined) or
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
487 poll-for-sigchld timer (used when BROKEN_SIGCHLD is defined) go
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
488 off. The latter two timers, if set, normally go off every 1/4
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
489 of a second -- see NORMAL_QUIT_CHECK_TIMEOUT_MSECS and
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
490 NORMAL_SIGCHLD_CHECK_TIMEOUT_MSECS. (Both of these timers are
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
491 treated like other asynchronous timeouts, but special-cased
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
492 in handle_async_timeout_signal().)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
493
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
494 -- we called slow_down_interrupts() and SLOWED_DOWN_INTERRUPTS_SECS
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
495 (or a multiple of it) has elapsed.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
496
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
497 Note that under Windows, we have no working setitimer(), so we
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
498 simulate it using the multimedia timeout functions,
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
499 e.g. timeSetEvent(). See setitimer() in nt.c.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
500
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
501 Note also that we don't actually *do* anything here (except in the
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
502 case of can_break_system_calls). Instead, we just set various
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
503 flags; next time QUIT is called, the flags will cause
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
504 check_what_happened() to be called, at which point we do everything
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
505 indicated by the flags.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
506 */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
507
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
508 static SIGTYPE
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
509 alarm_signal (int signo)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
510 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
511 something_happened = 1; /* tell QUIT to wake up and call
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
512 check_what_happened() */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
513
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
514 if (interrupts_slowed_down)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
515 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
516 /* we are in "slowed-down interrupts" mode; the only alarm
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
517 happening here is the slowed-down quit-check alarm, so
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
518 we set this flag.
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
519
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
520 Do NOT set async_timeout_happened, because we don't want
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
521 anyone looking at the timeout queue -- async timeouts
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
522 are disabled. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
523 quit_check_signal_happened = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
524 quit_check_signal_tick_count++;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
525 /* make sure we establish the slow timer again. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
526 slowed_interrupt_timeout_happened = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
527
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
528 /* can_break_system_calls is set when we want to break out of
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
529 non-interruptible system calls. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
530 if (can_break_system_calls)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
531 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
532 /* reset the flag for safety and such. Do this *before*
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
533 unblocking or reestablishing the signal to avoid potential
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
534 race conditions. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
535 can_break_system_calls = 0;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
536 #ifndef WIN32_NATIVE
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
537 /* #### I didn't add this WIN32_NATIVE check. I'm not sure
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
538 why it's here. But then again, someone needs to review
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
539 this can_break_system_calls stuff and see if it still
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
540 makes sense. --ben */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
541 EMACS_UNBLOCK_SIGNAL (signo);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
542 EMACS_REESTABLISH_SIGNAL (signo, alarm_signal);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
543 LONGJMP (break_system_call_jump, 0);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
544 #endif
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
545 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
546 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
547 else
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
548 {
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
549 async_timeout_happened = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
550 if (emacs_is_blocking)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
551 async_timeout_happened_while_emacs_was_blocking = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
552 /* #### This is for QUITP. When it is run, it may not be the
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
553 place to do arbitrary stuff like run asynch. handlers, but
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
554 it needs to know whether the poll-for-quit asynch. timeout
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
555 went off. Rather than put the code in to compute this
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
556 specially, we just set this flag. Should fix this. */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
557 quit_check_signal_happened = 1;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
558
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
559 #ifdef HAVE_UNIXOID_EVENT_LOOP
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
560 signal_fake_event ();
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
561 #endif
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
562 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
563
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
564 EMACS_REESTABLISH_SIGNAL (signo, alarm_signal);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
565 SIGRETURN;
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
566 }
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
567
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 /* Set this for debugging, to have a way to get out */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 int stop_character; /* #### not currently implemented */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
571 /* Signal handler for SIGINT and SIGQUIT. On TTY's, one of these two
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
572 signals will get generated in response to C-g. (When running under
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
573 X, C-g is handled using the SIGIO handler, which sets a flag
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
574 telling the QUIT macro to scan the unread events for a ^G.)
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
575 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 static SIGTYPE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 interrupt_signal (int sig)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 /* This function can call lisp */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 /* #### we should NOT be calling lisp from a signal handler, boys
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 and girls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 /* Must preserve main program's value of errno. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 int old_errno = errno;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 EMACS_REESTABLISH_SIGNAL (sig, interrupt_signal);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 if (sigint_happened && CONSOLEP (Vcontrolling_terminal) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 CONSOLE_LIVE_P (XCONSOLE (Vcontrolling_terminal)) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 !emacs_is_blocking)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 {
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
592 /* #### this is inherited from GNU Emacs. Do we really want this?
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
593 --ben */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 char c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 fflush (stdout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 reset_initial_console ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 EMACS_UNBLOCK_SIGNAL (sig);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 #ifdef SIGTSTP /* Support possible in later USG versions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 * On systems which can suspend the current process and return to the original
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 * shell, this command causes the user to end up back at the shell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 * The "Auto-save" and "Abort" questions are not asked until
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 * the user elects to return to emacs, at which point he can save the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 * job and either dump core or continue.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 sys_suspend ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 /* Perhaps should really fork an inferior shell?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 But that would not provide any way to get back
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 to the original shell, ever. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 stdout_out ("No support for stopping a process on this operating system;\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 stdout_out ("you can continue or abort.\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 #endif /* not SIGTSTP */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 stdout_out ("Auto-save? (y or n) ");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 if (((c = getc (stdin)) & ~040) == 'Y')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 Fdo_auto_save (Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 while (c != '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 c = getc (stdin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 stdout_out ("Abort (and dump core)? (y or n) ");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 if (((c = getc (stdin)) & ~040) == 'Y')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 while (c != '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 c = getc (stdin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 stdout_out ("Continuing...\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 reinit_initial_console ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 MARK_FRAME_CHANGED (XFRAME (DEVICE_SELECTED_FRAME
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 (XDEVICE (CONSOLE_SELECTED_DEVICE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 (XCONSOLE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (Vcontrolling_terminal))))));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 /* Else request quit when it's safe */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 Vquit_flag = Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 sigint_happened = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 #ifdef HAVE_UNIXOID_EVENT_LOOP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 signal_fake_event ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 errno = old_errno;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 SIGRETURN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
644
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
645 /**********************************************************************/
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
646 /* Control-G checking */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
647 /**********************************************************************/
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
648
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
649 /* Note: The code to handle QUIT is divided between lisp.h and signal.c.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
650 There is also some special-case code in the async timer code in
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
651 event-stream.c to notice when the poll-for-quit (and poll-for-sigchld)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
652 timers have gone off. */
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
653
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
654 /* OK, here's an overview of how this convoluted stuff works:
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
655
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
656 [1] Scattered throughout the XEmacs core code are calls to the macro QUIT;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
657 This macro checks to see whether a C-g has recently been pressed and
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
658 not yet handled, and if so, it handles the C-g by calling signal_quit(),
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
659 which invokes the standard Fsignal() code, with the error being Qquit.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
660 Lisp code can establish handlers for this (using condition-case), but
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
661 normally there is no handler, and so execution is thrown back to the
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
662 innermost enclosing event loop. (One of the things that happens when
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
663 entering an event loop is that a condition-case is established that
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
664 catches *all* calls to `signal', including this one.)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
665
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
666 [2] How does the QUIT macro check to see whether C-g has been pressed;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
667 obviously this needs to be extremely fast. Now for some history.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
668 In early Lemacs as inherited from the FSF going back 15 years or
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
669 more, there was a great fondness for using SIGIO (which is sent
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
670 whenever there is I/O available on a given socket, tty, etc.).
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
671 In fact, in GNU Emacs, perhaps even today, all reading of events
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
672 from the X server occurs inside the SIGIO handler! This is crazy,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
673 but not completely relevant. What is relevant is that similar
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
674 stuff happened inside the SIGIO handler for C-g: it searched
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
675 through all the pending (i.e. not yet delivered to XEmacs yet)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
676 X events for one that matched C-g. When it saw a match, it set
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
677 Vquit_flag to Qt. On TTY's, C-g is actually mapped to be the
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
678 interrupt character (i.e. it generates SIGINT), and XEmacs's
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
679 handler for this signal sets Vquit_flag to Qt. Then, sometime
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
680 later after the signal handlers finished and a QUIT macro was
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
681 called, the macro noticed the setting of Vquit_flag and used
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
682 this as an indication to call signal_quit(). What signal_quit()
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
683 actually does is set Vquit_flag to Qnil (so that we won't get
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
684 repeated interruptions from a single C-g press) and then calls
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
685 the equivalent of (signal 'quit nil).
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
686
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
687 [3] Another complication is introduced in that Vquit_flag is actually
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
688 exported to Lisp as `quit-flag'. This allows users some level of
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
689 control over whether and when C-g is processed as quit, esp. in
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
690 combination with `inhibit-quit'. This is another Lisp variable,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
691 and if set to non-nil, it inhibits signal_quit() from getting
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
692 called, meaning that the C-g gets essentially ignored. But not
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
693 completely: Because the resetting of `quit-flag' happens only
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
694 in signal_quit(), which isn't getting called, the C-g press is
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
695 still noticed, and as soon as `inhibit-quit' is set back to nil,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
696 a quit will be signalled at the next QUIT macro. Thus, what
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
697 `inhibit-quit' really does is defer quits until after the quit-
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
698 inhibitted period.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
699
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
700 [4] Another consideration, introduced by XEmacs, is critical quitting.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
701 If you press Control-Shift-G instead of just C-g, `quit-flag' is
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
702 set to `critical' instead of to t. When QUIT processes this value,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
703 it *ignores* the value of `inhibit-quit'. This allows you to quit
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
704 even out of a quit-inhibitted section of code! Furthermore, when
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
705 signal_quit() notices that it was invoked as a result of a critical
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
706 quit, it automatically invokes the debugger (which otherwise would
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
707 only happen when `debug-on-quit' is set to t).
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
708
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
709 [5] Well, I explained above about how `quit-flag' gets set correctly,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
710 but I began with a disclaimer stating that this was the old way
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
711 of doing things. What's done now? Well, first of all, the SIGIO
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
712 handler (which formerly checked all pending events to see if there's
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
713 a C-g) now does nothing but set a flag -- or actually two flags,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
714 something_happened and quit_check_signal_happened. There are two
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
715 flags because the QUIT macro is now used for more than just handling
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
716 QUIT; it's also used for running asynchronous timeout handlers that
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
717 have recently expired, and perhaps other things. The idea here is
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
718 that the QUIT macros occur extremely often in the code, but only occur
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
719 at places that are relatively safe -- in particular, if an error occurs,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
720 nothing will get completely trashed.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
721
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
722 [6] Now, let's look at QUIT again.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
723
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
724 UNFINISHED. Note, however, that as of the point when this comment
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
725 got committed to CVS (mid-2001), the interaction between reading
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
726 C-g as an event and processing it as QUIT was overhauled to (for
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
727 the first time) be understandable and actually work correctly.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
728 Now, the way things work is that if C-g is pressed while XEmacs is
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
729 blocking at the top level, waiting for a user event, it will be
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
730 read as an event; otherwise, it will cause QUIT. (This includes
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
731 times when XEmacs is blocking, but not waiting for a user event,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
732 e.g. accept-process-output and wait_delaying_user_events().)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
733 Formerly, this was supposed to happen, but didn't always due to a
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
734 bizarre and broken scheme, documented in next_event_internal
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
735 like this:
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
736
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
737 If we read a ^G, then set quit-flag but do not discard the ^G.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
738 The callers of next_event_internal() will do one of two things:
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
739
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
740 -- set Vquit_flag to Qnil. (next-event does this.) This will
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
741 cause the ^G to be treated as a normal keystroke.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
742 -- not change Vquit_flag but attempt to enqueue the ^G, at
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
743 which point it will be discarded. The next time QUIT is
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
744 called, it will notice that Vquit_flag was set.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
745
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
746 This required weirdness in enqueue_command_event_1 like this:
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
747
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
748 put the event on the typeahead queue, unless
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
749 the event is the quit char, in which case the `QUIT'
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
750 which will occur on the next trip through this loop is
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
751 all the processing we should do - leaving it on the queue
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
752 would cause the quit to be processed twice.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
753
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
754 And further weirdness elsewhere, none of which made any sense,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
755 and didn't work, because (e.g.) it required that QUIT never
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
756 happen anywhere inside next_event_internal() or any callers when
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
757 C-g should be read as a user event, which was impossible to
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
758 implement in practice.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
759
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
760 Now what we do is fairly simple. Callers of next_event_internal()
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
761 that want C-g read as a user event call begin_dont_check_for_quit().
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
762 next_event_internal(), when it gets a C-g, simply sets Vquit_flag
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
763 (just as when a C-g is detected during the operation of QUIT or
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
764 QUITP), and then tries to QUIT. This will fail if blocked by the
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
765 previous call, at which point next_event_internal() will return
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
766 the C-g as an event. To unblock things, first set Vquit_flag to
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
767 nil (it was set to t when the C-g was read, and if we don't reset
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
768 it, the next call to QUIT will quit), and then unbind_to() the
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
769 depth returned by begin_dont_check_for_quit(). It makes no
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
770 difference is QUIT is called a zillion times in next_event_internal()
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
771 or anywhere else, because it's blocked and will never signal.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
772
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
773 --ben
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
774 */
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
775
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
776
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
777 /* Defer all checking or processing of C-g. You can do this, for example,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
778 if you want to read C-g's as events. (In that case, you should set
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
779 Vquit_flag to Qnil just before you unbind, because it typically gets set
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
780 as a result of reading C-g.) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
781
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
782 int
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 begin_dont_check_for_quit (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
785 int depth = specpdl_depth ();
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
786 /* As an optimization in QUIT_FLAG_SAYS_SHOULD_QUIT, we bind inhibit-quit
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
787 to t -- it has to be checked anyway, and by doing this, we only need
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
788 to check dont_check_for_quit when quit-flag == `critical', which is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
789 rare. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 specbind (Qinhibit_quit, Qt);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
791 internal_bind_int (&dont_check_for_quit, 1);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
792
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
793 return depth;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
796 /* If we're inside of a begin_dont_check_for_quit() section, but want
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
797 to temporarily enable quit-checking, call this. This is used in
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
798 particular when processing menu filters -- some menu filters do
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
799 antisocial things like load large amounts of Lisp code (custom in
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
800 particular), and we obviously want a way of breaking out of any
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
801 problems. If you do use this, you should really be trapping the
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
802 throw() that comes from the quitting (as does the code that handles
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
803 menus popping up). */
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
804
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 int
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
806 begin_do_check_for_quit (void)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
807 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
808 int depth = specpdl_depth ();
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
809 specbind (Qinhibit_quit, Qnil);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
810 internal_bind_int (&dont_check_for_quit, 0);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
811 /* #### should we set Vquit_flag to Qnil? */
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
812 return depth;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
813 }
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
814
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
815 /* The effect of this function is to set Vquit_flag appropriately if the
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
816 user pressed C-g or Sh-C-g. After this function finishes, Vquit_flag
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
817 will be Qt for C-g, Qcritical for Sh-C-g, and unchanged otherwise.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
818 The C-g or Sh-C-g is discarded, so it won't be noticed again.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
819 */
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
820
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
821 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 check_quit (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 {
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
824 /* dont_check_for_quit is set in three circumstances:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 (1) when we are in the process of changing the window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 configuration. The frame might be in an inconsistent state,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 which will cause assertion failures if we check for QUIT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 (2) when we are reading events, and want to read the C-g
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 as an event. The normal check for quit will discard the C-g,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 which would be bad.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
834 (3) when we're going down with a fatal error. we're most likely
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
835 in an inconsistent state, and we definitely don't want to be
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
836 interrupted. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
838 /* We should *not* conditionalize on Vinhibit_quit, or
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 critical-quit (Control-Shift-G) won't work right. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
841 /* WARNING: Even calling check_quit(), without actually dispatching
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
842 a quit signal, can result in arbitrary Lisp code getting executed
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
843 -- at least under Windows. (Not to mention obvious Lisp
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
844 invocations like asynchronous timer callbacks.) Here's a sample
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
845 stack trace to demonstrate:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
846
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
847 NTDLL! DbgBreakPoint@0 address 0x77f9eea9
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
848 assert_failed(const char * 0x012d036c, int 4596, const char * 0x012d0354) line 3478
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
849 re_match_2_internal(re_pattern_buffer * 0x012d6780, const unsigned char * 0x00000000, int 0, const unsigned char * 0x022f9328, int 34, int 0, re_registers * 0x012d53d0 search_regs, int 34) line 4596 + 41 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
850 re_search_2(re_pattern_buffer * 0x012d6780, const char * 0x00000000, int 0, const char * 0x022f9328, int 34, int 0, int 34, re_registers * 0x012d53d0 search_regs, int 34) line 4269 + 37 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
851 re_search(re_pattern_buffer * 0x012d6780, const char * 0x022f9328, int 34, int 0, int 34, re_registers * 0x012d53d0 search_regs) line 4031 + 37 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
852 string_match_1(long 31222628, long 30282164, long 28377092, buffer * 0x022fde00, int 0) line 413 + 69 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
853 Fstring_match(long 31222628, long 30282164, long 28377092, long 28377092) line 436 + 34 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
854 Ffuncall(int 3, long * 0x008297f8) line 3488 + 168 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
855 execute_optimized_program(const unsigned char * 0x020ddc50, int 6, long * 0x020ddf50) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
856 funcall_compiled_function(long 34407748, int 1, long * 0x00829aec) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
857 Ffuncall(int 2, long * 0x00829ae8) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
858 execute_optimized_program(const unsigned char * 0x020ddc90, int 4, long * 0x020ddf90) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
859 funcall_compiled_function(long 34407720, int 1, long * 0x00829e28) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
860 Ffuncall(int 2, long * 0x00829e24) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
861 mapcar1(long 15, long * 0x00829e48, long 34447820, long 34187868) line 2929 + 11 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
862 Fmapcar(long 34447820, long 34187868) line 3035 + 21 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
863 Ffuncall(int 3, long * 0x00829f20) line 3488 + 93 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
864 execute_optimized_program(const unsigned char * 0x020c2b70, int 7, long * 0x020dd010) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
865 funcall_compiled_function(long 34407580, int 2, long * 0x0082a210) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
866 Ffuncall(int 3, long * 0x0082a20c) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
867 execute_optimized_program(const unsigned char * 0x020cf810, int 6, long * 0x020cfb10) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
868 funcall_compiled_function(long 34407524, int 0, long * 0x0082a580) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
869 Ffuncall(int 1, long * 0x0082a57c) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
870 run_hook_with_args_in_buffer(buffer * 0x022fde00, int 1, long * 0x0082a57c, int 0) line 3980 + 13 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
871 run_hook_with_args(int 1, long * 0x0082a57c, int 0) line 3993 + 23 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
872 Frun_hooks(int 1, long * 0x0082a57c) line 3847 + 19 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
873 run_hook(long 34447484) line 4094 + 11 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
874 unsafe_handle_wm_initmenu_1(frame * 0x01dbb000) line 736 + 11 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
875 unsafe_handle_wm_initmenu(long 28377092) line 807 + 11 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
876 condition_case_1(long 28377116, long (long)* 0x0101c827 unsafe_handle_wm_initmenu(long), long 28377092, long (long, long)* 0x01005fa4 mswindows_modal_loop_error_handler(long, long), long 28377092) line 1692 + 7 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
877 mswindows_protect_modal_loop(long (long)* 0x0101c827 unsafe_handle_wm_initmenu(long), long 28377092) line 1194 + 32 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
878 mswindows_handle_wm_initmenu(HMENU__ * 0x00010199, frame * 0x01dbb000) line 826 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
879 mswindows_wnd_proc(HWND__ * 0x000501da, unsigned int 278, unsigned int 65945, long 0) line 3089 + 31 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
880 USER32! UserCallWinProc@20 + 24 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
881 USER32! DispatchClientMessage@20 + 47 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
882 USER32! __fnDWORD@4 + 34 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
883 NTDLL! KiUserCallbackDispatcher@12 + 19 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
884 USER32! DispatchClientMessage@20 address 0x77e163cc
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
885 USER32! DefWindowProcW@16 + 34 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
886 qxeDefWindowProc(HWND__ * 0x000501da, unsigned int 274, unsigned int 61696, long 98) line 1188 + 22 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
887 mswindows_wnd_proc(HWND__ * 0x000501da, unsigned int 274, unsigned int 61696, long 98) line 3362 + 21 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
888 USER32! UserCallWinProc@20 + 24 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
889 USER32! DispatchClientMessage@20 + 47 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
890 USER32! __fnDWORD@4 + 34 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
891 NTDLL! KiUserCallbackDispatcher@12 + 19 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
892 USER32! DispatchClientMessage@20 address 0x77e163cc
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
893 USER32! DefWindowProcW@16 + 34 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
894 qxeDefWindowProc(HWND__ * 0x000501da, unsigned int 262, unsigned int 98, long 540016641) line 1188 + 22 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
895 mswindows_wnd_proc(HWND__ * 0x000501da, unsigned int 262, unsigned int 98, long 540016641) line 3362 + 21 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
896 USER32! UserCallWinProc@20 + 24 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
897 USER32! DispatchMessageWorker@8 + 244 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
898 USER32! DispatchMessageW@4 + 11 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
899 qxeDispatchMessage(const tagMSG * 0x0082c684 {msg=0x00000106 wp=0x00000062 lp=0x20300001}) line 989 + 10 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
900 mswindows_drain_windows_queue() line 1345 + 9 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
901 emacs_mswindows_quit_p() line 3947
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
902 event_stream_quit_p() line 666
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
903 check_quit() line 686
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
904 check_what_happened() line 437
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
905 re_match_2_internal(re_pattern_buffer * 0x012d5a18, const unsigned char * 0x00000000, int 0, const unsigned char * 0x02235000, int 23486, int 14645, re_registers * 0x012d53d0 search_regs, int 23486) line 4717 + 14 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
906 re_search_2(re_pattern_buffer * 0x012d5a18, const char * 0x02235000, int 23486, const char * 0x0223b38e, int 0, int 14645, int 8841, re_registers * 0x012d53d0 search_regs, int 23486) line 4269 + 37 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
907 search_buffer(buffer * 0x022fde00, long 29077572, long 13789, long 23487, long 1, int 1, long 28377092, long 28377092, int 0) line 1224 + 89 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
908 search_command(long 29077572, long 46975, long 28377116, long 28377092, long 28377092, int 1, int 1, int 0) line 1054 + 151 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
909 Fre_search_forward(long 29077572, long 46975, long 28377116, long 28377092, long 28377092) line 2147 + 31 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
910 Ffuncall(int 4, long * 0x0082ceb0) line 3488 + 216 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
911 execute_optimized_program(const unsigned char * 0x02047810, int 13, long * 0x02080c10) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
912 funcall_compiled_function(long 34187208, int 3, long * 0x0082d1b8) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
913 Ffuncall(int 4, long * 0x0082d1b4) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
914 execute_optimized_program(const unsigned char * 0x01e96a10, int 6, long * 0x020ae510) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
915 funcall_compiled_function(long 34186676, int 3, long * 0x0082d4a0) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
916 Ffuncall(int 4, long * 0x0082d49c) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
917 execute_optimized_program(const unsigned char * 0x02156b50, int 4, long * 0x020c2db0) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
918 funcall_compiled_function(long 34186564, int 2, long * 0x0082d780) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
919 Ffuncall(int 3, long * 0x0082d77c) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
920 execute_optimized_program(const unsigned char * 0x0082d964, int 3, long * 0x020c2d70) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
921 Fbyte_code(long 29405156, long 34352480, long 7) line 2392 + 38 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
922 Feval(long 34354440) line 3290 + 187 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
923 condition_case_1(long 34354572, long (long)* 0x01087232 Feval(long), long 34354440, long (long, long)* 0x01084764 run_condition_case_handlers(long, long), long 28377092) line 1692 + 7 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
924 condition_case_3(long 34354440, long 28377092, long 34354572) line 1779 + 27 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
925 execute_rare_opcode(long * 0x0082dc7c, const unsigned char * 0x01b090af, int 143) line 1269 + 19 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
926 execute_optimized_program(const unsigned char * 0x01b09090, int 6, long * 0x020ae590) line 654 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
927 funcall_compiled_function(long 34186620, int 0, long * 0x0082df68) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
928 Ffuncall(int 1, long * 0x0082df64) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
929 execute_optimized_program(const unsigned char * 0x02195470, int 1, long * 0x020c2df0) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
930 funcall_compiled_function(long 34186508, int 0, long * 0x0082e23c) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
931 Ffuncall(int 1, long * 0x0082e238) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
932 execute_optimized_program(const unsigned char * 0x01e5d410, int 6, long * 0x0207d410) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
933 funcall_compiled_function(long 34186312, int 1, long * 0x0082e524) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
934 Ffuncall(int 2, long * 0x0082e520) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
935 execute_optimized_program(const unsigned char * 0x02108fb0, int 2, long * 0x020c2e30) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
936 funcall_compiled_function(long 34186340, int 0, long * 0x0082e7fc) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
937 Ffuncall(int 1, long * 0x0082e7f8) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
938 execute_optimized_program(const unsigned char * 0x020fe150, int 2, long * 0x01e6f510) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
939 funcall_compiled_function(long 31008124, int 0, long * 0x0082ebd8) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
940 Ffuncall(int 1, long * 0x0082ebd4) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
941 run_hook_with_args_in_buffer(buffer * 0x022fde00, int 1, long * 0x0082ebd4, int 0) line 3980 + 13 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
942 run_hook_with_args(int 1, long * 0x0082ebd4, int 0) line 3993 + 23 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
943 Frun_hooks(int 1, long * 0x0082ebd4) line 3847 + 19 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
944 Ffuncall(int 2, long * 0x0082ebd0) line 3509 + 14 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
945 execute_optimized_program(const unsigned char * 0x01ef2210, int 5, long * 0x01da8e10) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
946 funcall_compiled_function(long 31020440, int 2, long * 0x0082eeb8) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
947 Ffuncall(int 3, long * 0x0082eeb4) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
948 execute_optimized_program(const unsigned char * 0x0082f09c, int 3, long * 0x01d89390) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
949 Fbyte_code(long 31102388, long 30970752, long 7) line 2392 + 38 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
950 Feval(long 31087568) line 3290 + 187 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
951 condition_case_1(long 30961240, long (long)* 0x01087232 Feval(long), long 31087568, long (long, long)* 0x01084764 run_condition_case_handlers(long, long), long 28510180) line 1692 + 7 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
952 condition_case_3(long 31087568, long 28510180, long 30961240) line 1779 + 27 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
953 execute_rare_opcode(long * 0x0082f450, const unsigned char * 0x01ef23ec, int 143) line 1269 + 19 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
954 execute_optimized_program(const unsigned char * 0x01ef2310, int 6, long * 0x01da8f10) line 654 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
955 funcall_compiled_function(long 31020412, int 1, long * 0x0082f740) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
956 Ffuncall(int 2, long * 0x0082f73c) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
957 execute_optimized_program(const unsigned char * 0x020fe650, int 3, long * 0x01d8c490) line 744 + 16 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
958 funcall_compiled_function(long 31020020, int 2, long * 0x0082fa14) line 516 + 53 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
959 Ffuncall(int 3, long * 0x0082fa10) line 3523 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
960 Fcall_interactively(long 29685180, long 28377092, long 28377092) line 1008 + 22 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
961 Fcommand_execute(long 29685180, long 28377092, long 28377092) line 2929 + 17 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
962 execute_command_event(command_builder * 0x01be1900, long 36626492) line 4048 + 25 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
963 Fdispatch_event(long 36626492) line 4341 + 70 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
964 Fcommand_loop_1() line 582 + 9 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
965 command_loop_1(long 28377092) line 495
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
966 condition_case_1(long 28377188, long (long)* 0x01064fb9 command_loop_1(long), long 28377092, long (long, long)* 0x010649d0 cmd_error(long, long), long 28377092) line 1692 + 7 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
967 command_loop_3() line 256 + 35 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
968 command_loop_2(long 28377092) line 269
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
969 internal_catch(long 28457612, long (long)* 0x01064b20 command_loop_2(long), long 28377092, int * volatile 0x00000000) line 1317 + 7 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
970 initial_command_loop(long 28377092) line 305 + 25 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
971 STACK_TRACE_EYE_CATCHER(int 1, char * * 0x01b63ff0, char * * 0x01ca5300, int 0) line 2501
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
972 main(int 1, char * * 0x01b63ff0, char * * 0x01ca5300) line 2938
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
973 XEMACS! mainCRTStartup + 180 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
974 _start() line 171
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
975 KERNEL32! BaseProcessStart@4 + 115547 bytes
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
976
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
977 */
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
978 int specdepth;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
979
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 if (dont_check_for_quit)
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
981 return;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 if (quit_check_signal_happened)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 {
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 872
diff changeset
985 /* Since arbitrary Lisp code may be executed (e.g. through a menu
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 872
diff changeset
986 filter, see backtrace directly above), GC might happen,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
987 which would majorly fuck a lot of things, e.g. re_match()
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
988 [string gets relocated] and lots of other code that's not
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
989 prepared to handle GC in QUIT. */
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
990 specdepth = begin_gc_forbidden ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 quit_check_signal_happened = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 event_stream_quit_p ();
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 617
diff changeset
993 unbind_to (specdepth);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 init_poll_for_quit (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 #if !defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 /* Check for C-g every 1/4 of a second.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 #### This is just a guess. Some investigation will have to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 done to see what the best value is. The best value is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 smallest possible value that doesn't cause a significant amount
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 of running time to be spent in C-g checking. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 if (!poll_for_quit_id)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 poll_for_quit_id =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 event_stream_generate_wakeup (NORMAL_QUIT_CHECK_TIMEOUT_MSECS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 NORMAL_QUIT_CHECK_TIMEOUT_MSECS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 Qnil, Qnil, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 #endif /* not SIGIO and not DONT_POLL_FOR_QUIT */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
1017 #if 0 /* not used anywhere */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
1018
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 reset_poll_for_quit (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 #if !defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 if (poll_for_quit_id)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 event_stream_disable_wakeup (poll_for_quit_id, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 poll_for_quit_id = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 #endif /* not SIGIO and not DONT_POLL_FOR_QUIT */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
1031 #endif /* 0 */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 442
diff changeset
1032
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
1033 #if defined (HAVE_UNIX_PROCESSES) && !defined (SIGCHLD)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 init_poll_for_sigchld (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 /* Check for terminated processes every 1/4 of a second.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 #### This is just a guess. Some investigation will have to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 done to see what the best value is. The best value is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 smallest possible value that doesn't cause a significant amount
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 of running time to be spent in process-termination checking.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 poll_for_sigchld_id =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 event_stream_generate_wakeup (NORMAL_SIGCHLD_CHECK_TIMEOUT_MSECS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 NORMAL_SIGCHLD_CHECK_TIMEOUT_MSECS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 Qnil, Qnil, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 #endif /* not SIGCHLD */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 /* If we've been nohup'ed, keep it that way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 This allows `nohup xemacs &' to work.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 More generally, if a normally fatal signal has been redirected
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 to SIG_IGN by our invocation environment, trust the environment.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 This keeps xemacs from being killed by a SIGQUIT intended for a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 different process after having been backgrounded under a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 non-job-control shell! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 handle_signal_if_fatal (int signo)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 {
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1068 if (EMACS_SIGNAL (signo, fatal_error_signal) == SIG_IGN)
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1069 EMACS_SIGNAL (signo, SIG_IGN);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 init_signals_very_early (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 /* Catch all signals that would kill us.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 Don't catch these signals in batch mode if not initialized.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 On some machines, this sets static data that would make
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 signal fail to work right when the dumped Emacs is run. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 if (noninteractive && !initialized)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 handle_signal_if_fatal (SIGILL); /* ANSI */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 handle_signal_if_fatal (SIGABRT); /* ANSI */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 handle_signal_if_fatal (SIGFPE); /* ANSI */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 handle_signal_if_fatal (SIGSEGV); /* ANSI */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 handle_signal_if_fatal (SIGTERM); /* ANSI */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 #ifdef SIGHUP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 handle_signal_if_fatal (SIGHUP); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 #ifdef SIGQUIT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 handle_signal_if_fatal (SIGQUIT); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 #ifdef SIGTRAP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 handle_signal_if_fatal (SIGTRAP); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 #ifdef SIGUSR1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 handle_signal_if_fatal (SIGUSR1); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 #ifdef SIGUSR2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 handle_signal_if_fatal (SIGUSR2); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 #ifdef SIGPIPE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 handle_signal_if_fatal (SIGPIPE); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 #ifdef SIGALRM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 /* This will get reset later, once we're
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 capable of handling it properly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 handle_signal_if_fatal (SIGALRM); /* POSIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 #ifdef SIGBUS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 handle_signal_if_fatal (SIGBUS); /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 #ifdef SIGSYS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 handle_signal_if_fatal (SIGSYS); /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 #ifdef SIGXCPU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 handle_signal_if_fatal (SIGXCPU); /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 #ifdef SIGXFSZ
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 handle_signal_if_fatal (SIGXFSZ); /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 #ifdef SIGVTALRM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 handle_signal_if_fatal (SIGVTALRM); /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 #ifdef SIGPROF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 /* Messes up the REAL profiler */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 /* handle_signal_if_fatal (SIGPROF); */ /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 #ifdef SIGHWE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 handle_signal_if_fatal (SIGHWE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 #ifdef SIGPRE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 handle_signal_if_fatal (SIGPRE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 #ifdef SIGORE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 handle_signal_if_fatal (SIGORE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 #ifdef SIGUME
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 handle_signal_if_fatal (SIGUME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 #ifdef SIGDLK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 handle_signal_if_fatal (SIGDLK);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 #ifdef SIGCPULIM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 handle_signal_if_fatal (SIGCPULIM);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 #ifdef SIGIOT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 handle_signal_if_fatal (SIGIOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 #ifdef SIGEMT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 handle_signal_if_fatal (SIGEMT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 #ifdef SIGLOST
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 handle_signal_if_fatal (SIGLOST);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 #ifdef SIGSTKFLT /* coprocessor stack fault under Linux */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 handle_signal_if_fatal (SIGSTKFLT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 #ifdef SIGUNUSED /* exists under Linux, and will kill process! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 handle_signal_if_fatal (SIGUNUSED);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 #ifdef AIX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 /* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 #ifndef _I386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 handle_signal_if_fatal (SIGIOINT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 handle_signal_if_fatal (SIGGRANT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 handle_signal_if_fatal (SIGRETRACT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 handle_signal_if_fatal (SIGSOUND);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 handle_signal_if_fatal (SIGMSG);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 #endif /* AIX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 #ifdef SIGDANGER
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 /* This just means available memory is getting low. */
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1182 EMACS_SIGNAL (SIGDANGER, memory_warning_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 syms_of_signal (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 DEFSUBR (Fwaiting_for_user_input_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 init_interrupts_late (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 if (!noninteractive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 {
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1197 EMACS_SIGNAL (SIGINT, interrupt_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 #ifdef HAVE_TERMIO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 /* On systems with TERMIO, C-g is set up for both SIGINT and SIGQUIT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 and we can't tell which one it will give us. */
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1201 EMACS_SIGNAL (SIGQUIT, interrupt_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 #endif /* HAVE_TERMIO */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 init_async_timeouts ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 #ifdef SIGIO
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1205 EMACS_SIGNAL (SIGIO, input_available_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 # ifdef SIGPOLL /* XPG5 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 /* Some systems (e.g. Motorola SVR4) losingly have different
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 values for SIGIO and SIGPOLL, and send SIGPOLL instead of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 SIGIO. On those same systems, an uncaught SIGPOLL kills the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 process. */
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 611
diff changeset
1211 EMACS_SIGNAL (SIGPOLL, input_available_signal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 #elif !defined (DONT_POLL_FOR_QUIT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214 init_poll_for_quit ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
1218 #if defined (HAVE_UNIX_PROCESSES) && !defined (SIGCHLD)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 init_poll_for_sigchld ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 EMACS_UNBLOCK_ALL_SIGNALS ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 interrupts_initted = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226