lib/async/container/generic.rb in async-container-0.16.9 vs lib/async/container/generic.rb in async-container-0.16.10
- old
+ new
@@ -159,11 +159,11 @@
return false
end
@statistics.spawn!
- Fiber.new do
+ fiber do
while @running
child = self.start(name, &block)
state = insert(key, child)
@@ -267,9 +267,21 @@
if key
@keyed.delete(key)
end
@state.delete(child)
+ end
+
+ private
+
+ if Fiber.respond_to?(:blocking)
+ def fiber(&block)
+ Fiber.new(blocking: true, &block)
+ end
+ else
+ def fiber(&block)
+ Fiber.new(&block)
+ end
end
end
end
end