mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
do_mutex_lock: release mutex before checking for interrupts (fixes issue 15360)
This commit is contained in:
parent
5e018214e7
commit
c1d78a7f0e
1 changed files with 5 additions and 1 deletions
|
@ -282,14 +282,18 @@ do_mutex_lock(VALUE self, int interruptible_p)
|
||||||
th->status = prev_status;
|
th->status = prev_status;
|
||||||
}
|
}
|
||||||
th->vm->sleeper--;
|
th->vm->sleeper--;
|
||||||
if (mutex->th == th) mutex_locked(th, self);
|
|
||||||
|
|
||||||
if (interruptible_p) {
|
if (interruptible_p) {
|
||||||
|
/* release mutex before checking for interrupts...as interrupt checking
|
||||||
|
* code might call rb_raise() */
|
||||||
|
if (mutex->th == th) mutex->th = 0;
|
||||||
RUBY_VM_CHECK_INTS_BLOCKING(th->ec); /* may release mutex */
|
RUBY_VM_CHECK_INTS_BLOCKING(th->ec); /* may release mutex */
|
||||||
if (!mutex->th) {
|
if (!mutex->th) {
|
||||||
mutex->th = th;
|
mutex->th = th;
|
||||||
mutex_locked(th, self);
|
mutex_locked(th, self);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (mutex->th == th) mutex_locked(th, self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue