Notify alerts any goroutines waiting on this signal that the event has occurred. After the first call to Notify(), future calls are no-op.
()
| 21 | // Notify alerts any goroutines waiting on this signal that the event has occurred. |
| 22 | // After the first call to Notify(), future calls are no-op. |
| 23 | func (s *Signal) Notify() { |
| 24 | s.once.Do(func() { |
| 25 | close(s.ch) |
| 26 | }) |
| 27 | } |
| 28 | |
| 29 | // Wait returns a channel which will be written to when Notify() is called for the first time. |
| 30 | // This channel will never be written to a second time. |