1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/ruby/bug-13526.rb
normal c7ff36c6f0 variable.c: cleanup waitq upon thread death
* variable.c (autoload_reset): use idempotent list_del_init
  (autoload_sleep): moved code from rb_autoload_load
  (autoload_sleep_done): cleanup for use with rb_ensure
  (rb_autoload_load): ensure list delete happens in case the
  thread dies during sleep
* test/ruby/bug-13526.rb: new script for separate execution
* test/ruby/test_autoload.rb (test_bug_13526): new test
  [ruby-core:81016] [Bug #13526]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 04:26:37 +00:00

20 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 }