Created
July 13, 2011 23:00
-
-
Save mvrilo/1081536 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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