add (*Progress).Shutdown()
Vladimir Bauer
3 years ago
| 235 | 235 | p.once.Do(p.shutdown) |
| 236 | 236 | |
| 237 | 237 | // wait for container to quit |
| 238 | p.cwg.Wait() | |
| 239 | } | |
| 240 | ||
| 241 | // Shutdown cancels any running bar immediatly and then shutdowns (*Progress) | |
| 242 | // instance. Normally you shouldn't call this method unless you know what are | |
| 243 | // you doing. Proper way to shutdown is to call (*Progress).Wait() instead. | |
| 244 | func (p *Progress) Shutdown() { | |
| 245 | p.cancel() | |
| 246 | p.bwg.Wait() | |
| 247 | p.once.Do(p.shutdown) | |
| 238 | 248 | p.cwg.Wait() |
| 239 | 249 | } |
| 240 | 250 |