mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 19:29:37 +00:00
A better solution for bug#29347
* src/thread.c (really_call_select): Don't try to take the global lock if the same thread is already holding it. (Bug#29347)
This commit is contained in:
parent
86e6ed8521
commit
f7fdaea4c0
1 changed files with 10 additions and 8 deletions
12
src/thread.c
12
src/thread.c
|
@ -97,11 +97,6 @@ post_acquire_global_lock (struct thread_state *self)
|
||||||
static void
|
static void
|
||||||
acquire_global_lock (struct thread_state *self)
|
acquire_global_lock (struct thread_state *self)
|
||||||
{
|
{
|
||||||
/* 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);
|
sys_mutex_lock (&global_lock);
|
||||||
post_acquire_global_lock (self);
|
post_acquire_global_lock (self);
|
||||||
}
|
}
|
||||||
|
@ -578,8 +573,15 @@ really_call_select (void *arg)
|
||||||
sa->timeout, sa->sigmask);
|
sa->timeout, sa->sigmask);
|
||||||
|
|
||||||
block_interrupt_signal (&oldset);
|
block_interrupt_signal (&oldset);
|
||||||
|
/* If we were interrupted by C-g while inside sa->func above, 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->not_holding_lock)
|
||||||
|
{
|
||||||
acquire_global_lock (self);
|
acquire_global_lock (self);
|
||||||
self->not_holding_lock = 0;
|
self->not_holding_lock = 0;
|
||||||
|
}
|
||||||
restore_signal_mask (&oldset);
|
restore_signal_mask (&oldset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue