diff options
| author | Eli Zaretskii | 2016-12-19 19:11:16 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-12-19 19:11:16 +0200 |
| commit | fe3188b1cecc7ac5534616c8edf14a84b1b3bbb0 (patch) | |
| tree | 39041b114c679f98255e9c95f2b4666d6f269ab2 /src/keyboard.c | |
| parent | 657bcaf5ac30449915e070c3fa80a2eaaf1ee7e1 (diff) | |
| download | emacs-fe3188b1cecc7ac5534616c8edf14a84b1b3bbb0.tar.gz 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.c | 3 |
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, | |||
| 2571 | so restore it now. */ | 2571 | so restore it now. */ |
| 2572 | restore_getcjmp (save_jump); | 2572 | restore_getcjmp (save_jump); |
| 2573 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | 2573 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); |
| 2574 | #if THREADS_ENABLED | ||
| 2575 | maybe_reacquire_global_lock (); | ||
| 2576 | #endif | ||
| 2574 | unbind_to (jmpcount, Qnil); | 2577 | unbind_to (jmpcount, Qnil); |
| 2575 | XSETINT (c, quit_char); | 2578 | XSETINT (c, quit_char); |
| 2576 | internal_last_event_frame = selected_frame; | 2579 | internal_last_event_frame = selected_frame; |