Class: Celluloid::TaskPooledFiber
- Inherits:
-
TaskFiber
- Object
- TaskFiber
- Celluloid::TaskPooledFiber
- Defined in:
- lib/celluloid/task_pooled_fiber.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.fiber_pool ⇒ Object
8 9 10 |
# File 'lib/celluloid/task_pooled_fiber.rb', line 8 def self.fiber_pool @fiber_pool ||= Util::FiberPool.new end |
Instance Method Details
#create(&block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/celluloid/task_pooled_fiber.rb', line 12 def create(&block) queue = Thread.current[:celluloid_queue] @fiber = TaskPooledFiber.fiber_pool.acquire do Thread.current[:celluloid_role] = :actor Thread.current[:celluloid_queue] = queue block.call end end |