Codebase list golang-github-vbauerster-mpb / 35ebac6
add cancel func to Progress Vladimir Bauer 3 years ago
1 changed file(s) with 3 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3131 done chan struct{}
3232 refreshCh chan time.Time
3333 once sync.Once
34 cancel func()
3435 }
3536
3637 // pState holds bars in its priorityQueue, it gets passed to (*Progress).serve monitor goroutine.
7071 // context. It's not possible to reuse instance after (*Progress).Wait
7172 // method has been called.
7273 func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
74 ctx, cancel := context.WithCancel(ctx)
7375 s := &pState{
7476 bHeap: priorityQueue{},
7577 rows: make([]io.Reader, 0, 64),
9496 operateState: make(chan func(*pState)),
9597 interceptIo: make(chan func(io.Writer)),
9698 done: make(chan struct{}),
99 cancel: cancel,
97100 }
98101
99102 p.cwg.Add(1)