* bug#25171: Error in thread causes Emacs to abort
@ 2016-12-11 14:23 Andreas Schwab
2016-12-11 16:13 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2016-12-11 14:23 UTC (permalink / raw)
To: 25171
When the function called by make-thread throws an error while Emacs is
reading from keyboard then it aborts in signal_or_quit because
waiting_for_input is non-zero.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#25171: Error in thread causes Emacs to abort
2016-12-11 14:23 bug#25171: Error in thread causes Emacs to abort Andreas Schwab
@ 2016-12-11 16:13 ` Eli Zaretskii
2016-12-11 17:43 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2016-12-11 16:13 UTC (permalink / raw)
To: Andreas Schwab, Tom Tromey; +Cc: 25171
> From: Andreas Schwab <schwab@linux-m68k.org>
> Date: Sun, 11 Dec 2016 15:23:15 +0100
>
> When the function called by make-thread throws an error while Emacs is
> reading from keyboard then it aborts in signal_or_quit because
> waiting_for_input is non-zero.
Right, thanks.
I think I fixed that now; the patch is below.
Tom, could you perhaps look at the patch and comment? I'm puzzled why
you didn't do this in the first place, like you did with
waiting_for_user_input_p. Are there any issues here that I'm missing?
TIA
diff --git a/src/keyboard.c b/src/keyboard.c
index 01b9b3c..cc78548 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -148,9 +148,6 @@ static Lisp_Object regular_top_level_message;
static sys_jmp_buf getcjmp;
-/* True while doing kbd input. */
-bool waiting_for_input;
-
/* True while displaying for echoing. Delays C-g throwing. */
static bool echoing;
@@ -322,10 +319,6 @@ static ptrdiff_t echo_length (void);
/* Incremented whenever a timer is run. */
unsigned timers_run;
-/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
- happens. */
-struct timespec *input_available_clear_time;
-
/* True means use SIGIO interrupts; false means use CBREAK mode.
Default is true if INTERRUPT_INPUT is defined. */
bool interrupt_input;
diff --git a/src/keyboard.h b/src/keyboard.h
index a5ed5e1..5084c39 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -415,13 +415,6 @@ extern void unuse_menu_items (void);
#define EVENT_HEAD_KIND(event_head) \
(Fget ((event_head), Qevent_kind))
-/* True while doing kbd input. */
-extern bool waiting_for_input;
-
-/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
- happens. */
-extern struct timespec *input_available_clear_time;
-
extern bool ignore_mouse_drag_p;
extern Lisp_Object parse_modifiers (Lisp_Object);
diff --git a/src/thread.h b/src/thread.h
index 6174032..f10824f 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -155,6 +155,15 @@ struct thread_state
int m_waiting_for_user_input_p;
#define waiting_for_user_input_p (current_thread->m_waiting_for_user_input_p)
+ /* True while doing kbd input. */
+ bool m_waiting_for_input;
+#define waiting_for_input (current_thread->m_waiting_for_input)
+
+ /* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
+ happens. */
+ struct timespec *m_input_available_clear_time;
+#define input_available_clear_time (current_thread->m_input_available_clear_time)
+
/* The OS identifier for this thread. */
sys_thread_t thread_id;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#25171: Error in thread causes Emacs to abort
2016-12-11 16:13 ` Eli Zaretskii
@ 2016-12-11 17:43 ` Eli Zaretskii
0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2016-12-11 17:43 UTC (permalink / raw)
To: schwab; +Cc: tom, 25171
> Date: Sun, 11 Dec 2016 18:13:34 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 25171@debbugs.gnu.org
>
> diff --git a/src/keyboard.c b/src/keyboard.c
> index 01b9b3c..cc78548 100644
> --- a/src/keyboard.c
> +++ b/src/keyboard.c
> @@ -148,9 +148,6 @@ static Lisp_Object regular_top_level_message;
>
> static sys_jmp_buf getcjmp;
>
> -/* True while doing kbd input. */
> -bool waiting_for_input;
> -
> /* True while displaying for echoing. Delays C-g throwing. */
>
> static bool echoing;
> @@ -322,10 +319,6 @@ static ptrdiff_t echo_length (void);
> /* Incremented whenever a timer is run. */
> unsigned timers_run;
>
> -/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
> - happens. */
> -struct timespec *input_available_clear_time;
> -
Actually, making input_available_clear_time thread-specific was a bad
idea (it causes current_thread dereferenced from a signal handler, and
current_thread could be NULL for short periods of time), so I undid it
in a followup commit.
The rest seems still valid.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-11 17:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-11 14:23 bug#25171: Error in thread causes Emacs to abort Andreas Schwab
2016-12-11 16:13 ` Eli Zaretskii
2016-12-11 17:43 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.