Class: Uh::WM::Workers::MultiplexingWorker
Constant Summary
collapse
- DEFAULT_TIMEOUT =
4
Instance Method Summary
collapse
Methods inherited from BaseWorker
#initialize
Instance Method Details
7
8
9
|
# File 'lib/uh/wm/workers/multiplexing_worker.rb', line 7
def configure(timeout: DEFAULT_TIMEOUT)
@timeout = timeout
end
|
#each_event ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/uh/wm/workers/multiplexing_worker.rb', line 17
def each_event
loop do
@logger.debug "select [#{@display_io.fileno}], _, _, #{@timeout}"
rs, _ = IO.select [@display_io], [], [], @timeout
@logger.debug " => #{rs.inspect}"
next if rs.nil? || rs.empty?
yield @display.next_event while @display.pending?
end
end
|
#setup ⇒ Object
11
12
13
14
15
|
# File 'lib/uh/wm/workers/multiplexing_worker.rb', line 11
def setup
@display_io = IO.new(@display.fileno)
@display.flush
self
end
|