(parent context.Context, child context.Context, cancel func())
| 51 | } |
| 52 | |
| 53 | func (t *Tomb) addChild(parent context.Context, child context.Context, cancel func()) { |
| 54 | if t.reason != ErrStillAlive { |
| 55 | cancel() |
| 56 | return |
| 57 | } |
| 58 | if t.child == nil { |
| 59 | t.child = make(map[interface{}]childContext) |
| 60 | } |
| 61 | t.child[parent] = childContext{child, cancel, child.Done()} |
| 62 | for parent, child := range t.child { |
| 63 | select { |
| 64 | case <-child.done: |
| 65 | delete(t.child, parent) |
| 66 | default: |
| 67 | } |
| 68 | } |
| 69 | } |
no test coverage detected