@@ -148,7 +148,7 @@ type PipeWriter struct {
148
148
}
149
149
150
150
// Write implements the standard Write interface:
151
- // it writes data to the pipe, blocking until readers
151
+ // it writes data to the pipe, blocking until one or more readers
152
152
// have consumed all the data or the read end is closed.
153
153
// If the read end is closed with an error, that err is
154
154
// returned as err; otherwise err is ErrClosedPipe.
@@ -175,11 +175,17 @@ func (w *PipeWriter) CloseWithError(err error) error {
175
175
// Pipe creates a synchronous in-memory pipe.
176
176
// It can be used to connect code expecting an io.Reader
177
177
// with code expecting an io.Writer.
178
- // Reads on one end are matched with writes on the other,
179
- // copying data directly between the two; there is no internal buffering.
180
- // It is safe to call Read and Write in parallel with each other or with
181
- // Close. Close will complete once pending I/O is done. Parallel calls to
182
- // Read, and parallel calls to Write, are also safe:
178
+ //
179
+ // Reads and Writes on the pipe are matched one to one
180
+ // except when multiple Reads are needed to consume a single Write.
181
+ // That is, each Write to the PipeWriter blocks until it has satisfied
182
+ // one or more Reads from the PipeReader that fully consume
183
+ // the written data.
184
+ // The data is copied directly from the Write to the corresponding
185
+ // Read (or Reads); there is no internal buffering.
186
+ //
187
+ // It is safe to call Read and Write in parallel with each other or with Close.
188
+ // Parallel calls to Read and parallel calls to Write are also safe:
183
189
// the individual calls will be gated sequentially.
184
190
func Pipe () (* PipeReader , * PipeWriter ) {
185
191
p := new (pipe )
0 commit comments