diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-26 15:39:06 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-26 15:39:06 +0000 |
commit | 331512759b2edbebf5bb225129d0cb3d4b452e92 (patch) | |
tree | c5f1f18022b0bbac78f1c289acb82b5e19efab36 /thread_sync.c | |
parent | a9a3769530072559d429fc3b7132fef4e32f27b2 (diff) |
merge revision(s) c1d78a7f0ece2004822193a0c1f1fd3dc38c2fdf: [Backport #15360]
do_mutex_lock: release mutex before checking for interrupts (fixes
issue 15360)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_sync.c')
-rw-r--r-- | thread_sync.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/thread_sync.c b/thread_sync.c index 8964e24a5f..f775d44451 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -289,14 +289,18 @@ do_mutex_lock(VALUE self, int interruptible_p) th->status = prev_status; } th->vm->sleeper--; - if (mutex->th == th) mutex_locked(th, self); 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 */ if (!mutex->th) { mutex->th = th; mutex_locked(th, self); } + } else { + if (mutex->th == th) mutex_locked(th, self); } } } |