Skip to content
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

Implement changes of ruby-3.0 to IO#wait #2953

Merged
merged 6 commits into from
Mar 31, 2023

Conversation

larskanis
Copy link
Contributor

Ruby-3.0 got a lot of IO changes; one of them was that IO#wait was changed to support IO event mask like the Fiber.scheduler is using. This is what pg-1.4.x.gem makes use of.

PG tests for IO::READABLE and IO::READABLE to be defined and expects the new IO#wait API to be available in that case. See https://github.com/ged/ruby-pg/blob/43f3ea0b50040683080392a2802bca0d74504922/lib/pg/connection.rb#L596

Now that truffleruby master branch defines these constants the connection setup fails with wrong number of arguments (given 2, expected 0..1), due to the alias to wait_readable.

I implemented the method based on the C code of MRI: https://github.com/ruby/ruby/blob/758e4db551e7e80a65b610cc73fcb61e74ec5a0c/io.c#L9749

IO#wait used to be a alias to wait_readable years ago, but the interface changed a lot.

Also update the related tests from MRI.
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 20, 2023
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! I'll review it in more details soon.

test/mri/tests/io/wait/test_io_wait.rb Show resolved Hide resolved
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks great. I just pushed small cleanups.

@eregon eregon added the in-ci The PR is being tested in CI. Do not push new commits. label Mar 21, 2023
graalvmbot pushed a commit that referenced this pull request Mar 31, 2023
@graalvmbot graalvmbot merged commit 272eb88 into oracle:master Mar 31, 2023
@larskanis larskanis deleted the fix-io-wait branch April 1, 2023 12:11
graalvmbot pushed a commit that referenced this pull request Apr 6, 2023
PullRequest: truffleruby/3724
(cherry picked from commit 365a678)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants