Function fd::splice_loop [] [src]

pub fn splice_loop(do_flush: Arc<AtomicBool>, flush_event: Option<Sender<()>>, fd_in: RawFd, fd_out: RawFd)

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())).