summaryrefslogtreecommitdiff
path: root/test/ruby/bug-13526.rb
blob: 50c6c67a7d24dc9118bba2d94e4090597a6fd99a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# From https://bugs.ruby-lang.org/issues/13526#note-1

Thread.report_on_exception = true

sleep if $load
$load = true

n = 10
threads = Array.new(n) do
  Thread.new do
    begin
      autoload :Foo, File.expand_path(__FILE__)
      Thread.pass
      Foo
    ensure
      Thread.pass
    end
  end
end

Thread.pass until threads.all?(&:stop?)
1000.times { Thread.pass }