diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-15 07:27:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-15 07:27:04 +0000 |
commit | 9a1f664d6eff1ea58e5764f872846b172abce24e (patch) | |
tree | 157caf5954fe280a74a6196cc3c64a97de21441d /thread.c | |
parent | cd9ca82f4883ad65bf5faba13f7106bfff82e40d (diff) | |
download | ruby-9a1f664d6eff1ea58e5764f872846b172abce24e.tar.gz |
thread.c: fix deadlock
* thread.c (thread_join_sleep): the target thread may exit during
`RUBY_VM_CHECK_INTS_BLOCKING`, but `sleep_forever` does not
consider the condition change to wait.
[ruby-core:84248] [Bug #14181]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -883,7 +883,13 @@ thread_join_sleep(VALUE arg) while (target_th->status != THREAD_KILLED) { if (forever) { - sleep_forever(th, TRUE, FALSE); + th->status = THREAD_STOPPED_FOREVER; + th->vm->sleeper++; + rb_check_deadlock(th->vm); + native_sleep(th, 0); + th->vm->sleeper--; + RUBY_VM_CHECK_INTS_BLOCKING(th->ec); + th->status = THREAD_RUNNABLE; } else { double now = timeofday(); |