Wait blocks until all goroutines have finished running, and then returns the reason for their death.
()
| 131 | // Wait blocks until all goroutines have finished running, and |
| 132 | // then returns the reason for their death. |
| 133 | func (t *Tomb) Wait() error { |
| 134 | t.init() |
| 135 | <-t.dead |
| 136 | t.m.Lock() |
| 137 | reason := t.reason |
| 138 | t.m.Unlock() |
| 139 | return reason |
| 140 | } |
| 141 | |
| 142 | // Go runs f in a new goroutine and tracks its termination. |
| 143 | // |