| 33 | 33 |
priority int
|
| 34 | 34 |
index int
|
| 35 | 35 |
|
| 36 | |
runningBar *Bar
|
| 37 | |
cacheState *bState
|
| 38 | |
operateState chan func(*bState)
|
| 39 | |
int64Ch chan int64
|
| 40 | |
boolCh chan bool
|
| 41 | |
frameReaderCh chan *frameReader
|
| 42 | |
syncTableCh chan [][]chan int
|
|
36 |
runningBar *Bar
|
|
37 |
cacheState *bState
|
|
38 |
operateState chan func(*bState)
|
|
39 |
int64Ch chan int64
|
|
40 |
boolCh chan bool
|
|
41 |
bFrameCh chan *bFrame
|
|
42 |
syncTableCh chan [][]chan int
|
| 43 | 43 |
|
| 44 | 44 |
// done is closed by Bar's goroutine, after cacheState is written
|
| 45 | 45 |
done chan struct{}
|
|
| 73 | 73 |
priority int
|
| 74 | 74 |
runningBar *Bar
|
| 75 | 75 |
}
|
| 76 | |
frameReader struct {
|
| 77 | |
io.Reader
|
|
76 |
bFrame struct {
|
|
77 |
rd io.Reader
|
| 78 | 78 |
extendedLines int
|
| 79 | 79 |
toShutdown bool
|
| 80 | 80 |
removeOnComplete bool
|
|
| 115 | 115 |
}
|
| 116 | 116 |
|
| 117 | 117 |
b := &Bar{
|
| 118 | |
priority: s.priority,
|
| 119 | |
runningBar: s.runningBar,
|
| 120 | |
operateState: make(chan func(*bState)),
|
| 121 | |
int64Ch: make(chan int64),
|
| 122 | |
boolCh: make(chan bool),
|
| 123 | |
frameReaderCh: make(chan *frameReader, 1),
|
| 124 | |
syncTableCh: make(chan [][]chan int),
|
| 125 | |
done: make(chan struct{}),
|
| 126 | |
shutdown: make(chan struct{}),
|
|
118 |
priority: s.priority,
|
|
119 |
runningBar: s.runningBar,
|
|
120 |
operateState: make(chan func(*bState)),
|
|
121 |
int64Ch: make(chan int64),
|
|
122 |
boolCh: make(chan bool),
|
|
123 |
bFrameCh: make(chan *bFrame, 1),
|
|
124 |
syncTableCh: make(chan [][]chan int),
|
|
125 |
done: make(chan struct{}),
|
|
126 |
shutdown: make(chan struct{}),
|
| 127 | 127 |
}
|
| 128 | 128 |
|
| 129 | 129 |
if b.runningBar != nil {
|
|
| 283 | 283 |
if p := recover(); p != nil {
|
| 284 | 284 |
s.panicMsg = fmt.Sprintf("panic: %v", p)
|
| 285 | 285 |
fmt.Fprintf(debugOut, "%s %s bar id %02d %v\n", "[mpb]", time.Now(), s.id, s.panicMsg)
|
| 286 | |
b.frameReaderCh <- &frameReader{
|
| 287 | |
Reader: strings.NewReader(fmt.Sprintf(fmt.Sprintf("%%.%ds\n", tw), s.panicMsg)),
|
|
286 |
b.bFrameCh <- &bFrame{
|
|
287 |
rd: strings.NewReader(fmt.Sprintf(fmt.Sprintf("%%.%ds\n", tw), s.panicMsg)),
|
| 288 | 288 |
toShutdown: true,
|
| 289 | 289 |
}
|
| 290 | 290 |
}
|
|
| 296 | 296 |
extendedLines = countLines(s.bufE.Bytes())
|
| 297 | 297 |
r = io.MultiReader(r, s.bufE)
|
| 298 | 298 |
}
|
| 299 | |
b.frameReaderCh <- &frameReader{
|
| 300 | |
Reader: r,
|
|
299 |
b.bFrameCh <- &bFrame{
|
|
300 |
rd: r,
|
| 301 | 301 |
extendedLines: extendedLines,
|
| 302 | 302 |
toShutdown: s.toComplete && !s.completeFlushed,
|
| 303 | 303 |
removeOnComplete: s.removeOnComplete,
|
|
| 313 | 313 |
extendedLines = countLines(s.bufE.Bytes())
|
| 314 | 314 |
r = io.MultiReader(r, s.bufE)
|
| 315 | 315 |
}
|
| 316 | |
b.frameReaderCh <- &frameReader{
|
| 317 | |
Reader: r,
|
|
316 |
b.bFrameCh <- &bFrame{
|
|
317 |
rd: r,
|
| 318 | 318 |
extendedLines: extendedLines,
|
| 319 | 319 |
}
|
| 320 | 320 |
}
|