Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'eventmachine'
require 'fiber'
def process
f = Fiber.current
EM.add_timer(2){ puts "Time's Up!"; f.resume }
Fiber.yield
puts "Process Done!"
EM.stop
end
EM.run{
Fiber.new{
# here i don't want to pass the fiber in, so Fiber.current would be useful
process
}.resume
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment