Skip to content

Instantly share code, notes, and snippets.

@chuckremes
Created December 6, 2017 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuckremes/ab075d21917441f0cc85c35d19becb20 to your computer and use it in GitHub Desktop.
Save chuckremes/ab075d21917441f0cc85c35d19becb20 to your computer and use it in GitHub Desktop.
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