Class: Uh::WM::Workers::Mux

Inherits:
Base
  • Object
show all
Defined in:
lib/uh/wm/workers/mux.rb

Constant Summary collapse

TIMEOUT_DEFAULT =
1

Constants inherited from Base

Base::CALLBACKS

Instance Method Summary collapse

Methods inherited from Base

#watch

Constructor Details

#initialize(timeout: TIMEOUT_DEFAULT) ⇒ Mux

Returns a new instance of Mux.



7
8
9
10
# File 'lib/uh/wm/workers/mux.rb', line 7

def initialize timeout: TIMEOUT_DEFAULT
  super
  @timeout = timeout
end

Instance Method Details

#work_eventsObject



12
13
14
15
16
# File 'lib/uh/wm/workers/mux.rb', line 12

def work_events
  @before_watch.call if @before_watch
  if res = select(@ios, [], [], @timeout) then @on_read.call res
  else @on_timeout.call if @on_timeout end
end