no need for barPopQueue
Vladimir Bauer
5 years ago
| 40 | 40 | pMatrix map[int][]chan int |
| 41 | 41 | aMatrix map[int][]chan int |
| 42 | 42 | barShutdownQueue []*Bar |
| 43 | barPopQueue []*Bar | |
| 44 | 43 | |
| 45 | 44 | // following are provided/overrided by user |
| 46 | 45 | idCount int |
| 301 | 300 | delete(s.parkedBars, b) |
| 302 | 301 | b.toDrop = true |
| 303 | 302 | } |
| 303 | if s.popCompleted && !b.noPop { | |
| 304 | lineCount -= b.extendedLines + 1 | |
| 305 | b.toDrop = true | |
| 306 | } | |
| 304 | 307 | if b.toDrop { |
| 305 | 308 | delete(bm, b) |
| 306 | s.heapUpdated = true | |
| 307 | } else if s.popCompleted { | |
| 308 | if b := b; !b.noPop { | |
| 309 | defer func() { | |
| 310 | s.barPopQueue = append(s.barPopQueue, b) | |
| 311 | }() | |
| 312 | } | |
| 313 | 309 | } |
| 314 | 310 | b.cancel() |
| 315 | 311 | } |
| 316 | 312 | s.barShutdownQueue = s.barShutdownQueue[0:0] |
| 317 | ||
| 318 | for _, b := range s.barPopQueue { | |
| 319 | delete(bm, b) | |
| 320 | s.heapUpdated = true | |
| 321 | lineCount -= b.extendedLines + 1 | |
| 322 | } | |
| 323 | s.barPopQueue = s.barPopQueue[0:0] | |
| 324 | 313 | |
| 325 | 314 | for b := range bm { |
| 326 | 315 | heap.Push(&s.bHeap, b) |