code: def call_inputhook(self, input_is_ready_func):
          
          self._input_is_ready = input_is_ready_func
  
          # Start thread that activates this pipe when there is input to process.
          def thread():
              input_is_ready_func(wait=True)
              os.write(self._w, b'x')
  
          threading.Thread(target=thread).start()
  
          # Call inputhook.
          self.inputhook(self)
  
          # Flush the read end of the pipe.
          try:
              # Before calling 'os.read', call select.select. This is required
              # when the gevent monkey patch has been applied. 'os.read' is never
              # monkey patched and won't be cooperative, so that would block all
              # other select() calls otherwise.
              # See: http://www.gevent.org/gevent.os.html
  
              # Note: On Windows, this is apparently not an issue.
              #       However, if we would ever want to add a select call, it
              #       should use `windll.kernel32.WaitForMultipleObjects`,
              #       because `select.select` can't wait for a pipe on Windows.
              if not is_windows():
                  select_fds([self._r], timeout=None)
  
              os.read(self._r, 1024)
          except OSError:
              # This happens when the window resizes and a SIGWINCH was received.
              # We get 'Error: [Errno 4] Interrupted system call'
              # Just ignore.
              pass
          self._input_is_ready = None
docs: Call the inputhook. (Called by a prompt-toolkit eventloop.)