Skip to content

Commit

Permalink
Updating CloseWithError documentation #4
Browse files Browse the repository at this point in the history
  • Loading branch information
djherbis committed Jan 25, 2017
1 parent bfaed0c commit 824ca90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions nio.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ type Buffer interface {
// It can be used to connect code expecting an io.Reader with code expecting an io.Writer.
// Reads on one end read from the supplied Buffer. Writes write to the supplied Buffer.
// It is safe to call Read and Write in parallel with each other or with Close.
// Close will complete once pending I/O is done. Buffered data will still be available to Read
// after the Writer has been closed. Parallel calls to Read, and parallel calls to Write are also safe :
// Close will complete once pending I/O is done, and may cancel blocking Read/Writes.
// Buffered data will still be available to Read after the Writer has been closed.
// Parallel calls to Read, and parallel calls to Write are also safe :
// the individual calls will be gated sequentially.
func Pipe(buf Buffer) (r *PipeReader, w *PipeWriter) {
p := newBufferedPipe(buf)
Expand Down
2 changes: 1 addition & 1 deletion sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (w *PipeWriter) CloseWithError(err error) error {
}

// Close closes the writer; once the buffer is empty subsequent reads from the read half of the pipe will return
// no bytes and io.EOF after all the buffer has been read.
// no bytes and io.EOF after all the buffer has been read. CloseWithError always returns nil.
func (w *PipeWriter) Close() error {
return w.CloseWithError(nil)
}
Expand Down

0 comments on commit 824ca90

Please sign in to comment.