Codebase list golang-github-vbauerster-mpb / 71608c0
EnableTriggerComplete only after total has been set Vladimir Bauer 4 years ago
1 changed file(s) with 5 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
156156 }
157157
158158 // EnableTriggerComplete enables triggering complete event. It's
159 // effective only for bar which was constructed with `total <= 0`.
160 // If bar has been incremented to the total, complete event is
161 // triggered right away.
159 // effective only for bar which was constructed with `total <= 0` and
160 // after total has been set with (*Bar).SetTotal(int64, false). If bar
161 // has been incremented to the total, complete event is triggered right
162 // away.
162163 func (b *Bar) EnableTriggerComplete() {
163164 select {
164165 case b.operateState <- func(s *bState) {
165 if s.triggerComplete {
166 if s.triggerComplete || s.total <= 0 {
166167 return
167168 }
168169 if s.current >= s.total {