| // Copyright 2014 The Go Authors. |
| // See https://code.google.com/p/go/source/browse/CONTRIBUTORS |
| // Licensed under the same terms as Go itself: |
| // https://code.google.com/p/go/source/browse/LICENSE |
| // Read waits until data is available and copies bytes |
| // from the buffer into p. |
| func (r *pipe) Read(p []byte) (n int, err error) { |
| for r.b.Len() == 0 && !r.b.closed { |
| // Write copies bytes from p into the buffer and wakes a reader. |
| // It is an error to write more data than the buffer can hold. |
| func (w *pipe) Write(p []byte) (n int, err error) { |
| func (c *pipe) Close(err error) { |