2015-12-16 05:07:31 +00:00
|
|
|
# frozen_string_literal: false
|
2015-06-14 22:52:01 +00:00
|
|
|
class TestLastThread < Test::Unit::TestCase
|
|
|
|
|
|
|
|
# [Bug #11237]
|
|
|
|
def test_last_thread
|
2018-07-20 22:30:39 +00:00
|
|
|
if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
|
|
|
|
skip 'spurious wakeup unavoidable with MJIT'
|
|
|
|
end
|
2015-06-14 22:52:01 +00:00
|
|
|
|
|
|
|
assert_separately([], <<-"end;") #do
|
|
|
|
require '-test-/gvl/call_without_gvl'
|
|
|
|
|
|
|
|
Thread.new {
|
|
|
|
sleep 0.2
|
|
|
|
}
|
|
|
|
|
|
|
|
t0 = Time.now
|
|
|
|
Thread.current.__runnable_sleep__ 1
|
|
|
|
t1 = Time.now
|
|
|
|
t = t1 - t0
|
|
|
|
|
2015-06-19 08:12:54 +00:00
|
|
|
assert_in_delta(1.0, t, 0.16)
|
2015-06-14 22:52:01 +00:00
|
|
|
end;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|