@@ -3252,18 +3252,26 @@ impl<B: BufRead> Iterator for Lines<B> {
32523252 }
32533253}
32543254
3255- /// Create anonymous pipe that is close-on-exec and blocking.
3255+ /// Create an anonymous pipe that is close-on-exec and blocking.
32563256///
32573257/// # Behavior
32583258///
3259- /// A pipe is a synchronous, unidirectional data channel between two or more processes, like an
3260- /// interprocess [`mpsc`](crate::sync::mpsc) provided by the OS. In particular:
3259+ /// A pipe is a one-way data channel provided by the OS, which works across processes. A pipe is
3260+ /// typically used to communicate between two or more separate processes, as there are better,
3261+ /// faster ways to communicate within a single process.
3262+ ///
3263+ /// In particular:
32613264///
32623265/// * A read on a [`PipeReader`] blocks until the pipe is non-empty.
32633266/// * A write on a [`PipeWriter`] blocks when the pipe is full.
32643267/// * When all copies of a [`PipeWriter`] are closed, a read on the corresponding [`PipeReader`]
32653268/// returns EOF.
3266- /// * [`PipeReader`] can be shared, but only one process will consume the data in the pipe.
3269+ /// * [`PipeWriter`] can be shared, and multiple processes or threads can write to it at once, but
3270+ /// writes (above a target-specific threshold) may have their data interleaved.
3271+ /// * [`PipeReader`] can be shared, and multiple processes or threads can read it at once. Any
3272+ /// given byte will only get consumed by one reader. There are no guarantees about data
3273+ /// interleaving.
3274+ /// * Portable applications cannot assume any atomicity of messages larger than a single byte.
32673275///
32683276/// # Capacity
32693277///
@@ -3301,21 +3309,19 @@ impl<B: BufRead> Iterator for Lines<B> {
33013309/// # Ok(())
33023310/// # }
33033311/// ```
3304- /// [pipe]: https://man7.org/linux/man-pages/man2/pipe.2.html
3305- /// [CreatePipe]: https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe
33063312/// [man page]: https://man7.org/linux/man-pages/man7/pipe.7.html
33073313#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
33083314#[ inline]
33093315pub fn pipe ( ) -> Result < ( PipeReader , PipeWriter ) > {
33103316 pipe_inner ( ) . map ( |( reader, writer) | ( PipeReader ( reader) , PipeWriter ( writer) ) )
33113317}
33123318
3313- /// Read end of the anonymous pipe.
3319+ /// Read end of an anonymous pipe.
33143320#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
33153321#[ derive( Debug ) ]
33163322pub struct PipeReader ( pub ( crate ) AnonPipe ) ;
33173323
3318- /// Write end of the anonymous pipe.
3324+ /// Write end of an anonymous pipe.
33193325#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
33203326#[ derive( Debug ) ]
33213327pub struct PipeWriter ( pub ( crate ) AnonPipe ) ;
0 commit comments