summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-12-19 19:11:16 +0200
committerEli Zaretskii <eliz@gnu.org>2016-12-19 19:11:16 +0200
commitfe3188b1cecc7ac5534616c8edf14a84b1b3bbb0 (patch)
tree39041b114c679f98255e9c95f2b4666d6f269ab2 /src/keyboard.c
parent657bcaf5ac30449915e070c3fa80a2eaaf1ee7e1 (diff)
downloademacs-fe3188b1cecc7ac5534616c8edf14a84b1b3bbb0.tar.gz
emacs-fe3188b1cecc7ac5534616c8edf14a84b1b3bbb0.tar.bz2
emacs-fe3188b1cecc7ac5534616c8edf14a84b1b3bbb0.zip
Fix crashes upon C-g on Posix TTY frames
* src/thread.h (struct thread_state): New member not_holding_lock. (maybe_reacquire_global_lock): Add prototype. * src/thread.c: Include syssignal.h. (maybe_reacquire_global_lock): New function. (really_call_select): Set the not_holding_lock member of the thread state before releasing the lock, and rest it after re-acquiring the lock when the select function returns. Block SIGINT while doing this to make sure we are not interrupted on TTY frames. * src/sysdep.c (block_interrupt_signal, restore_signal_mask): New functions. * src/syssignal.h (block_interrupt_signal, restore_signal_mask): Add prototypes. * src/keyboard.c (read_char) [THREADS_ENABLED]: Call maybe_reacquire_global_lock. (Bug#25178)
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 1fb1d492ce6..f2ee313b8c9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2571,6 +2571,9 @@ read_char (int commandflag, Lisp_Object map,
so restore it now. */
restore_getcjmp (save_jump);
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
+#if THREADS_ENABLED
+ maybe_reacquire_global_lock ();
+#endif
unbind_to (jmpcount, Qnil);
XSETINT (c, quit_char);
internal_last_event_frame = selected_frame;