Done returns a channel which is closed if and when this pipe is closed with CloseWithError.
()
| 171 | // Done returns a channel which is closed if and when this pipe is closed |
| 172 | // with CloseWithError. |
| 173 | func (p *pipe) Done() <-chan struct{} { |
| 174 | p.mu.Lock() |
| 175 | defer p.mu.Unlock() |
| 176 | if p.donec == nil { |
| 177 | p.donec = make(chan struct{}) |
| 178 | if p.err != nil || p.breakErr != nil { |
| 179 | // Already hit an error. |
| 180 | p.closeDoneLocked() |
| 181 | } |
| 182 | } |
| 183 | return p.donec |
| 184 | } |