Mark heapUpdated, when bar is removed
Vladimir Bauer
8 years ago
| 208 | 208 | close(trs.bar.shutdown) |
| 209 | 209 | } |
| 210 | 210 | if r.toRemove { |
| 211 | heap.Remove(s.bHeap, trs.bar.index) | |
| 211 | s.heapUpdated = heap.Remove(s.bHeap, trs.bar.index) != nil | |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | func calcMax(slice []int) int { |
| 239 | if len(slice) == 0 { | |
| 240 | return 0 | |
| 241 | } | |
| 242 | ||
| 239 | 243 | max := slice[0] |
| 240 | ||
| 241 | 244 | for i := 1; i < len(slice); i++ { |
| 242 | 245 | if slice[i] > max { |
| 243 | 246 | max = slice[i] |
| 244 | 247 | } |
| 245 | 248 | } |
| 246 | ||
| 247 | 249 | return max |
| 248 | 250 | } |