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: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a5ae02498178
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 79e4f128d4f9
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Oct 7, 2015

  1. Copy the full SHA
    877b38b View commit details
  2. Copy the full SHA
    79e4f12 View commit details
Showing with 15 additions and 7 deletions.
  1. +15 −7 kernel/common/io.rb
22 changes: 15 additions & 7 deletions kernel/common/io.rb
Original file line number Diff line number Diff line change
@@ -260,7 +260,9 @@ def read(length, output_string=nil)

def read_into_storage(count, storage)
while true
Thread.current.instance_variable_set(:@sleep, true)
bytes_read = FFI::Platform::POSIX.read(descriptor, storage, count)
Thread.current.instance_variable_set(:@sleep, false)

if FFI.call_failed?(bytes_read)
errno = Errno.errno
@@ -481,7 +483,7 @@ def blocking?
(FileDescriptor.get_flags(@descriptor) & O_NONBLOCK) == 0
end

def set_blocking
def clear_nonblock
flags = FileDescriptor.get_flags(@descriptor)
FileDescriptor.clear_flag(O_NONBLOCK, @descriptor)
end
@@ -642,7 +644,7 @@ def write_nonblock(str)
buffer.write_string(str)

if FFI.call_failed?(bytes_written = FFI::Platform::POSIX.write(@descriptor, buffer, left))
set_block
clear_nonblocking
Errno.handle("write_nonblock")
end

@@ -871,11 +873,17 @@ def self.select(readables, writables, errorables, timeout)

events = 0
loop do
if FFI.call_failed?(events = FFI::Platform::POSIX.select(max_fd + 1,
read_set ? read_set.to_set : nil,
write_set ? write_set.to_set : nil,
error_set ? error_set.to_set : nil,
time_limit))
Thread.current.instance_variable_set(:@sleep, true)

events = FFI::Platform::POSIX.select(max_fd + 1,
(read_set ? read_set.to_set : nil),
(write_set ? write_set.to_set : nil),
(error_set ? error_set.to_set : nil),
time_limit)

Thread.current.instance_variable_set(:@sleep, false)

if FFI.call_failed?(events)

if Errno::EAGAIN::Errno == Errno.errno || Errno::EINTR::Errno == Errno.errno
# return nil if async_interruption?