@@ -3252,18 +3252,26 @@ impl<B: BufRead> Iterator for Lines<B> {
3252
3252
}
3253
3253
}
3254
3254
3255
- /// Create anonymous pipe that is close-on-exec and blocking.
3255
+ /// Create an anonymous pipe that is close-on-exec and blocking.
3256
3256
///
3257
3257
/// # Behavior
3258
3258
///
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:
3261
3264
///
3262
3265
/// * A read on a [`PipeReader`] blocks until the pipe is non-empty.
3263
3266
/// * A write on a [`PipeWriter`] blocks when the pipe is full.
3264
3267
/// * When all copies of a [`PipeWriter`] are closed, a read on the corresponding [`PipeReader`]
3265
3268
/// 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.
3267
3275
///
3268
3276
/// # Capacity
3269
3277
///
@@ -3301,21 +3309,19 @@ impl<B: BufRead> Iterator for Lines<B> {
3301
3309
/// # Ok(())
3302
3310
/// # }
3303
3311
/// ```
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
3306
3312
/// [man page]: https://man7.org/linux/man-pages/man7/pipe.7.html
3307
3313
#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
3308
3314
#[ inline]
3309
3315
pub fn pipe ( ) -> Result < ( PipeReader , PipeWriter ) > {
3310
3316
pipe_inner ( ) . map ( |( reader, writer) | ( PipeReader ( reader) , PipeWriter ( writer) ) )
3311
3317
}
3312
3318
3313
- /// Read end of the anonymous pipe.
3319
+ /// Read end of an anonymous pipe.
3314
3320
#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
3315
3321
#[ derive( Debug ) ]
3316
3322
pub struct PipeReader ( pub ( crate ) AnonPipe ) ;
3317
3323
3318
- /// Write end of the anonymous pipe.
3324
+ /// Write end of an anonymous pipe.
3319
3325
#[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
3320
3326
#[ derive( Debug ) ]
3321
3327
pub struct PipeWriter ( pub ( crate ) AnonPipe ) ;
0 commit comments