WithShutdownNotifier: chan<- interface{}
Vladimir Bauer
3 years ago
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | // WithShutdownNotifier provided chanel will be closed, after all bars | |
| 59 | // have been rendered. | |
| 60 | func WithShutdownNotifier(ch chan struct{}) ContainerOption { | |
| 58 | // WithShutdownNotifier value of type `[]*mpb.Bar` will be send into provided | |
| 59 | // channel upon container shutdown. | |
| 60 | func WithShutdownNotifier(ch chan<- interface{}) ContainerOption { | |
| 61 | 61 | return func(s *pState) { |
| 62 | select { | |
| 63 | case <-ch: | |
| 64 | default: | |
| 65 | s.shutdownNotifier = ch | |
| 66 | } | |
| 62 | s.shutdownNotifier = ch | |
| 67 | 63 | } |
| 68 | 64 | } |
| 69 | 65 |