mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
21 lines
334 B
Ruby
21 lines
334 B
Ruby
|
# 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 }
|