diff options
| author | Eli Zaretskii | 2017-11-24 23:37:42 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-11-24 23:37:42 +0200 |
| commit | f7fdaea4c0a2f4285d974a2870c4f6b465b40500 (patch) | |
| tree | 014c77cb84fc9d338159d0f2a3f2f77287906631 /src/thread.c | |
| parent | 86e6ed8521564105a42ae52851b6bff7e3a12a94 (diff) | |
| download | emacs-f7fdaea4c0a2f4285d974a2870c4f6b465b40500.tar.gz emacs-f7fdaea4c0a2f4285d974a2870c4f6b465b40500.zip | |
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)
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 18 |
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) | |||
| 97 | static void | 97 | static void |
| 98 | acquire_global_lock (struct thread_state *self) | 98 | acquire_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 | ||