EasyExit is a struct that helps you build a close switch and signal which can be called multiple times safely, and used as a signal many times in parallel. It can also provide a context, if you prefer to use that as a signal instead.
| 110 | // be called multiple times safely, and used as a signal many times in parallel. |
| 111 | // It can also provide a context, if you prefer to use that as a signal instead. |
| 112 | type EasyExit struct { |
| 113 | mutex *sync.Mutex |
| 114 | exit chan struct{} |
| 115 | once *sync.Once |
| 116 | err error |
| 117 | wg *sync.WaitGroup |
| 118 | } |
| 119 | |
| 120 | // NewEasyExit builds an easy exit struct. |
| 121 | func NewEasyExit() *EasyExit { |
nothing calls this directly
no outgoing calls
no test coverage detected