~singpolyma/em_fiberscheduler

de31dc7b7d612b89f93611fd12d2517600e181c4 — Stephen Paul Weber 4 months ago f17337f
Add address_resolve
1 files changed, 10 insertions(+), 0 deletions(-)

M lib/em-fiberscheduler.rb
M lib/em-fiberscheduler.rb => lib/em-fiberscheduler.rb +10 -0
@@ 123,6 123,16 @@ module EventMachine
			EM.cancel_timer(timer) if timer
		end

		def address_resolve(hostname)
			fiber = Fiber.current
			EM.schedule do
				defer = DNS::Resolver.resolve(hostname)
				defer.callback(&fiber.method(:resume))
				defer.errback(&fiber.method(:raise))
			end
			Fiber.yield
		end

		module WatchProcess
			attr_writer :fiber