Skip to content

Instantly share code, notes, and snippets.

@mvrilo
Created July 13, 2011 23:00
Show Gist options
  • Save mvrilo/1081536 to your computer and use it in GitHub Desktop.
Save mvrilo/1081536 to your computer and use it in GitHub Desktop.
require 'eio/eventmachine'
TMPFILE = File.expand_path(File.join(File.dirname(__FILE__), "test"))
EM.run do
EIO.eventmachine_handler
EIO.open(TMPFILE, EIO::RDWR) do |fd|
EIO.read(fd) do |buf|
data = "#{buf} ok"
EIO.write(fd, data) do |data|
EIO.close(fd)
EM.stop
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment