MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / flush

Method flush

serial_buffer/src/lib.rs:98–110  ·  view source on GitHub ↗

This function flushes the content of the buffer to the out device if it is allowed to, otherwise this is a no-op.

(&mut self)

Source from the content-addressed store, hash-verified

96 // This function flushes the content of the buffer to the out device if
97 // it is allowed to, otherwise this is a no-op.
98 fn flush(&mut self) -> Result<(), std::io::Error> {
99 if !self.write_out.load(Ordering::Acquire) {
100 return Ok(());
101 }
102
103 while let Some(byte) = self.buffer.pop_front() {
104 if self.out.write_all(&[byte]).is_err() {
105 self.buffer.push_front(byte);
106 break;
107 }
108 }
109 self.out.flush()
110 }
111}

Callers 1

writeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected