Serve starts the pool.
()
| 75 | |
| 76 | // Serve starts the pool. |
| 77 | func (p *pool) Serve() { |
| 78 | ticker := time.NewTicker(gcInterval) |
| 79 | defer ticker.Stop() |
| 80 | |
| 81 | for { |
| 82 | select { |
| 83 | case <-ticker.C: |
| 84 | p.runGC() |
| 85 | case <-p.done: |
| 86 | return |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // Stop stops the pool. |
| 92 | func (p *pool) Stop() { |