emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 f300852: Avoid a hang after C-g while sit-for on


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 f300852: Avoid a hang after C-g while sit-for on a Unix TTY
Date: Fri, 24 Nov 2017 11:15:52 -0500 (EST)

branch: emacs-26
commit f3008520376a5d0fe3aa13bc5fa7a103e1623055
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid a hang after C-g while sit-for on a Unix TTY
    
    * src/thread.c (acquire_global_lock): Don't try to take the global
    lock if the same thread is already holding it.  (Bug#29347)
---
 src/thread.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/thread.c b/src/thread.c
index c03cdda..1ded8f5 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -97,7 +97,12 @@ post_acquire_global_lock (struct thread_state *self)
 static void
 acquire_global_lock (struct thread_state *self)
 {
-  sys_mutex_lock (&global_lock);
+  /* If some Lisp was interrupted by C-g while inside pselect, the
+     signal handler could have called maybe_reacquire_global_lock, in
+     which case we are already holding the lock and shouldn't try
+     taking it again, or else we will hang forever.  */
+  if (!(self && self->not_holding_lock))
+    sys_mutex_lock (&global_lock);
   post_acquire_global_lock (self);
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]