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

sleep if $load
$load = true

n = 10
threads = Array.new(n) do
  Thread.new do
    begin
      autoload :Foo, "#{File.dirname($0)}/#{$0}"
      Thread.pass
      Foo
    ensure
      Thread.pass
    end
  end
end

Thread.pass while threads.all?(&:stop?)
100.times { Thread.pass }