aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/thread.c b/src/thread.c
index 9e799ce47d4..dd466818ef9 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -97,12 +97,7 @@ post_acquire_global_lock (struct thread_state *self)
97static void 97static void
98acquire_global_lock (struct thread_state *self) 98acquire_global_lock (struct thread_state *self)
99{ 99{
100 /* If some Lisp was interrupted by C-g while inside pselect, the 100 sys_mutex_lock (&global_lock);
101 signal handler could have called maybe_reacquire_global_lock, in
102 which case we are already holding the lock and shouldn't try
103 taking it again, or else we will hang forever. */
104 if (!(self && !self->not_holding_lock))
105 sys_mutex_lock (&global_lock);
106 post_acquire_global_lock (self); 101 post_acquire_global_lock (self);
107} 102}
108 103
@@ -578,8 +573,15 @@ really_call_select (void *arg)
578 sa->timeout, sa->sigmask); 573 sa->timeout, sa->sigmask);
579 574
580 block_interrupt_signal (&oldset); 575 block_interrupt_signal (&oldset);
581 acquire_global_lock (self); 576 /* If we were interrupted by C-g while inside sa->func above, the
582 self->not_holding_lock = 0; 577 signal handler could have called maybe_reacquire_global_lock, in
578 which case we are already holding the lock and shouldn't try
579 taking it again, or else we will hang forever. */
580 if (self->not_holding_lock)
581 {
582 acquire_global_lock (self);
583 self->not_holding_lock = 0;
584 }
583 restore_signal_mask (&oldset); 585 restore_signal_mask (&oldset);
584} 586}
585 587