pub fn splice_loop(
do_flush: Arc<AtomicBool>,
flush_event: Option<Sender<()>>,
fd_in: RawFd,
fd_out: RawFd,
)Expand description
Loop while reading and writing from one file descriptor to another using splice(2).
The loop stop when do_flush is set to true.
At the end, a flush event is send to flush_event if any.
This function should be used in a dedicated thread, e.g. thread::spawn(move || splice_loop(do_flush, None, rx.as_raw_fd(), tx.as_raw_fd())).
You should ensure that there is no append flag to the fd_out file descriptor.
You can use unset_append_flag() if needed and set_flags() to restore to the initial state.