Module: JOffice::FiberEvents

Defined in:
lib/joffice/fiber_events_pool.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.class_fiber_poolObject



32
33
34
# File 'lib/joffice/fiber_events_pool.rb', line 32

def class_fiber_pool
  @@class_fiber_pool||={}
end

.loggerObject



24
25
26
# File 'lib/joffice/fiber_events_pool.rb', line 24

def logger
  @@logger
end

.logger=(v) ⇒ Object



28
29
30
# File 'lib/joffice/fiber_events_pool.rb', line 28

def logger=(v)
  @@logger=v
end

Instance Method Details

#loggerObject



37
38
39
# File 'lib/joffice/fiber_events_pool.rb', line 37

def logger
  @@logger
end

#register_fiber_and_singleton_task(key) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/joffice/fiber_events_pool.rb', line 81

def register_fiber_and_singleton_task(key)
  if (queue=fiber_queue[key])
    queue << Fiber.current        
    result=Fiber.yield
  else
    fiber_queue[key]=[]
    begin
      result=yield
    ensure    
      fire_events(key, result);  
    end
  end
  result
end