Instantly share code, notes, and snippets.

@chuckremes chuckremes/x.rb
Created Dec 6, 2017

Embed
What would you like to do?
def IO.read(offset:, length:, buffer:, sync: true)
if sync
IO::Sync.read(offset: offset, length: length, buffer: buffer)
return buffer
else
future = IO::Async.read(offset: offset, length: length, buffer: buffer)
return future.suspend_until_resolved
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment