Method: Cod::Select#do
- Defined in:
- lib/cod/select.rb
#do ⇒ Hash, ...
Performs the IO.select and returns a thinned out version of that initial groups, containing only FDs and channels that are ready for reading.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cod/select.rb', line 37 def do fds = groups.values { |e| to_read_fd(e) }.compact # Perform select r,w,e = IO.select(fds, nil, nil, timeout) # Nothing is ready if r is nil return groups.empty unless r # Prepare a return value: The original hash, where the fds are ready. groups. keep_if { |e| r.include?(to_read_fd(e)) }. unpack end |