Module: Cramp::FiberPool::UsesFiberPool

Defined in:
lib/cramp/fiber_pool.rb

Instance Method Summary collapse

Instance Method Details

#callback_wrapperObject

Overrides wrapper methods to run callbacks in a fiber



24
25
26
27
28
29
30
31
32
# File 'lib/cramp/fiber_pool.rb', line 24

def callback_wrapper
  self.fiber_pool.spawn do
    begin
      yield
    rescue StandardError, LoadError, SyntaxError => exception
      handle_exception(exception)
    end
  end
end

#timer_method_wrapper(method) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/cramp/fiber_pool.rb', line 34

def timer_method_wrapper(method)
  self.fiber_pool.spawn do
    begin
      send(method)
    rescue StandardError, LoadError, SyntaxError => exception
      handle_exception(exception)
    end
  end
end