Codebase list golang-github-vbauerster-mpb / a7f8f80
complete with timeout Vladimir Bauer 9 years ago
1 changed file(s) with 5 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2727
2828 // Bar represents a progress Bar
2929 type Bar struct {
30 incrCh chan incrReq
3130 completeReqCh chan struct{}
3231 done chan struct{}
3332 inProgress chan struct{}
3837 state state
3938 }
4039
41 // Refil is a struct for b.IncrWithReFill
42 type refill struct {
43 char rune
44 till int64
45 }
46
4740 type (
48 incrReq struct {
49 amount int64
50 refill *refill
41 refill struct {
42 char rune
43 till int64
5144 }
5245 state struct {
5346 id int
8679 }
8780
8881 b := &Bar{
89 incrCh: make(chan incrReq),
9082 completeReqCh: make(chan struct{}),
9183 done: make(chan struct{}),
9284 inProgress: make(chan struct{}),
228220 b.Complete()
229221 }
230222 }:
231 default:
223 case <-time.After(prr):
224 return
232225 }
233226 }
234227