• Eli Zaretskii's avatar
    Avoid crashes on C-g when several threads wait for input · ea39d470
    Eli Zaretskii authored
    * src/thread.h (m_getcjmp): New member of 'struct thread_state'.
    (getcjmp): Define to current thread's 'm_getcjmp'.
    * src/thread.c (maybe_reacquire_global_lock): Switch to main
    thread, since this is called from a SIGINT handler, which always
    runs in the context of the main thread.
    * src/lisp.h (sys_jmp_buf, sys_setjmp, sys_longjmp): Move the
    definitions before thread.h is included, as thread.h now uses
    sys_jmp_buf.
    * src/keyboard.c (getcjmp): Remove declaration.
    (read_char): Don't call maybe_reacquire_global_lock here.
    (handle_interrupt): Call maybe_reacquire_global_lock here, if
    invoked from the SIGINT handler, to make sure
    quit_throw_to_read_char runs with main thread's Lisp bindings and
    uses the main thread's jmp_buf buffer.  (Bug#28630)
    ea39d470
lisp.h 151 KB