• Eli Zaretskii's avatar
    Fix crashes upon C-g on Posix TTY frames · fe3188b1
    Eli Zaretskii authored
    * 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
    * src/sysdep.c (block_interrupt_signal, restore_signal_mask): New
    * 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)
thread.c 24.8 KB