code: def _read_select_poll(poll):
          
          npipes = len(NonBlockingStreamReader._streams)
          for stream_descr in NonBlockingStreamReader._streams:
              if not stream_descr.has_error:
                  poll.register(stream_descr.stream,
                                select.POLLIN | select.POLLERR | select.POLLHUP | select.POLLNVAL)
  
          while NonBlockingStreamReader._run_flag:
              for (file_descr, event) in poll.poll(500):
                  if event == select.POLLIN:
                      NonBlockingStreamReader._read_fd(file_descr)
                  else:
                      # Because event != select.POLLIN, the pipe is closed
                      # but we still want to read all bytes
                      while NonBlockingStreamReader._read_fd(file_descr) != 0:
                          pass
                      # Dut died, signal the processing thread so it notices that no lines coming in
                      stream_descr = NonBlockingStreamReader._get_sd(file_descr)
                      if stream_descr is None:
                          return # PIPE closed but DUT already disappeared
                      stream_descr.has_error = True
                      if stream_descr.callback is not None:
                          stream_descr.callback()
                          return # Force poll object to reregister only alive descriptors
  
              # Check if new pipes added, don't need mutext just for reading the size
              # If we will not get it right now, we will at next time
              if npipes != len(NonBlockingStreamReader._streams):
                  return
docs: Read PIPEs using select.poll() method
          Available on Linux and some Unixes