summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-10-28 15:27:00 -0700
committerGitHub <noreply@github.com>2020-10-28 15:27:00 -0700
commitdfb3605bbee9c3cfbc1c354594c367472f29cb35 (patch)
treec45c7551fad0baeb053771468bd534b396bfd4bf /test
parenta99f52d5113a601b6d18bd671dfee24266689ffe (diff)
Add Thread.ignore_deadlock accessor
Setting this to true disables the deadlock detector. It should only be used in cases where the deadlock could be broken via some external means, such as via a signal. Now that $SAFE is no longer used, replace the safe_level_ VM flag with ignore_deadlock for storing the setting. Fixes [Bug #13768]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3710 Merged-By: jeremyevans <code@jeremyevans.net>
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_thread.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 30a3cc784e..0af7a37cf8 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -490,6 +490,19 @@ class TestThread < Test::Unit::TestCase
end;
end
+ def test_ignore_deadlock
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ skip "can't trap a signal from another process on Windows"
+ end
+ assert_in_out_err([], <<-INPUT, %w(false :sig), [], :signal=>:INT, timeout: 1, timeout_error: nil)
+ p Thread.ignore_deadlock
+ q = Queue.new
+ trap(:INT){q.push :sig}
+ Thread.ignore_deadlock = true
+ p q.pop
+ INPUT
+ end
+
def test_status_and_stop_p
a = ::Thread.new {
Thread.current.report_on_exception = false