Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 276a7d220518
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a65ad3a6655b
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on May 26, 2016

  1. Copy the full SHA
    aa425d6 View commit details
  2. wait_readable in MRI appears to always block, so we should too.

    This may have been an oversight; 0 means don't wait on the select
    at all, but I may have been confused thinking it meant wait
    forever. Doing waitReadable but not waiting for it to be readable
    seems obviously wrong.
    headius committed May 26, 2016
    Copy the full SHA
    f4d66bd View commit details
  3. Merge pull request #3929 from headius/waitreadable_blocking

    waitReadable should block
    headius committed May 26, 2016
    Copy the full SHA
    a65ad3a View commit details
Showing with 3 additions and 2 deletions.
  1. +2 −1 core/src/main/java/org/jruby/RubyIO.java
  2. +1 −1 core/src/main/java/org/jruby/util/io/OpenFile.java
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -2853,9 +2853,10 @@ IRubyObject getPartial(ThreadContext context, IRubyObject[] args, boolean nonblo
// n = arg.len;
n = OpenFile.readInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), len);
if (n < 0) {
Errno e = fptr.errno();
if (!nonblock && fptr.waitReadable(context))
continue again;
if (nonblock && (fptr.errno() == Errno.EWOULDBLOCK || fptr.errno() == Errno.EAGAIN)) {
if (nonblock && (e == Errno.EWOULDBLOCK || e == Errno.EAGAIN)) {
if (noException) return runtime.newSymbol("wait_readable");
throw runtime.newErrnoEAGAINReadableError("read would block");
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/io/OpenFile.java
Original file line number Diff line number Diff line change
@@ -492,7 +492,7 @@ public boolean waitReadable(ThreadContext context, long timeout) {

// rb_io_wait_readable
public boolean waitReadable(ThreadContext context) {
return waitReadable(context, 0);
return waitReadable(context, -1);
}

/**