Skip to content

Instantly share code, notes, and snippets.

@releu
Created March 6, 2012 19:19
Show Gist options
  • Save releu/1988392 to your computer and use it in GitHub Desktop.
Save releu/1988392 to your computer and use it in GitHub Desktop.
test fibers
process = Fiber.new do
i = 0
loop do
puts "process_#{i = i.next}"
sleep 0.1
Fiber.yield
end
end
loop do
if File.exists?('/Users/releu/pause')
sleep 0.1
else
process.resume unless
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment