()
| 49 | } |
| 50 | |
| 51 | func (ws *workerStack) detach() worker { |
| 52 | l := ws.len() |
| 53 | if l == 0 { |
| 54 | return nil |
| 55 | } |
| 56 | |
| 57 | w := ws.items[l-1] |
| 58 | ws.items[l-1] = nil // avoid memory leaks |
| 59 | ws.items = ws.items[:l-1] |
| 60 | |
| 61 | return w |
| 62 | } |
| 63 | |
| 64 | func (ws *workerStack) refresh(duration time.Duration) []worker { |
| 65 | n := ws.len() |