Skip to content

Hook up autoload method to use rb_ractor_autoload_load when in ractor #13553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luke-gruber
Copy link
Contributor

The following code had issues because autoload was not calling into the appropriate ractor autoload code:

require "tmpdir"
rs = []
tmpdir = Dir.mktmpdir("autoload")
path = File.join(tmpdir, "a.rb")
File.open(path, 'w') do |f|
  f.write("class A; end\n")
end

100.times do
  rs << Ractor.new(path) do |path|
    autoload :A, path
  end
end

while rs.any?
  r, obj = Ractor.select(*rs)
  rs.delete(r)
end

…ctor

The following code had issues because `autoload` was not calling into
the appropriate ractor autoload code:

```ruby
require "tmpdir"
rs = []
tmpdir = Dir.mktmpdir("autoload")
path = File.join(tmpdir, "a.rb")
File.open(path, 'w') do |f|
  f.write("class A; end\n")
end

100.times do
  rs << Ractor.new(path) do |path|
    autoload :A, path
  end
end

while rs.any?
  r, obj = Ractor.select(*rs)
  rs.delete(r)
end
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant