summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2017-10-06 09:50:54 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2017-10-06 09:50:54 -0400
commit11f9cb522fed9aa6552f6315340ca7352661a1e8 (patch)
tree39facc48471c67b321c045e47d70ef030adbea44 /src/thread.c
parent92045f4546b9708dc9f69954799d211c1f56ff1e (diff)
parent9655937da4a339300c624addd97674c038a01bc9 (diff)
downloademacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.tar.gz
emacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.tar.bz2
emacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.zip
Merge emacs-26
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/thread.c b/src/thread.c
index 42d7791ad0f..d075bdb3a13 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -101,14 +101,20 @@ acquire_global_lock (struct thread_state *self)
post_acquire_global_lock (self);
}
-/* This is called from keyboard.c when it detects that SIGINT
- interrupted thread_select before the current thread could acquire
- the lock. We must acquire the lock to prevent a thread from
- running without holding the global lock, and to avoid repeated
- calls to sys_mutex_unlock, which invokes undefined behavior. */
+/* This is called from keyboard.c when it detects that SIGINT was
+ delivered to the main thread and interrupted thread_select before
+ the main thread could acquire the lock. We must acquire the lock
+ to prevent a thread from running without holding the global lock,
+ and to avoid repeated calls to sys_mutex_unlock, which invokes
+ undefined behavior. */
void
maybe_reacquire_global_lock (void)
{
+ /* SIGINT handler is always run on the main thread, see
+ deliver_process_signal, so reflect that in our thread-tracking
+ variables. */
+ current_thread = &main_thread;
+
if (current_thread->not_holding_lock)
{
struct thread_state *self = current_thread;