pub(in virtio::console) fn spawn_input_thread(
    input: Box<dyn SerialInput>,
    in_avail_evt: Event,
    input_buffer: Arc<Mutex<VecDeque<u8>>>
) -> WorkerThread<Box<dyn SerialInput>>
Expand description

Starts a thread that reads input and sends the input back via the provided buffer.

The caller should listen on in_avail_evt for events. When in_avail_evt signals that data is available, the caller should lock input_buffer and read data out of the inner VecDeque. The data should be removed from the beginning of the VecDeque as it is processed.

§Arguments

  • input - Data source that the reader thread will wait on to send data back to the buffer
  • in_avail_evt - Event triggered by the thread when new input is available on the buffer