Fire causes e to complete. It is safe to call multiple times, and concurrently. It returns true iff this call to Fire caused the signaling channel returned by Done to close. If Fire returns false, it is possible the Done channel has not been closed yet.
()
| 35 | // channel returned by Done to close. If Fire returns false, it is possible |
| 36 | // the Done channel has not been closed yet. |
| 37 | func (e *Event) Fire() bool { |
| 38 | if e.fired.CompareAndSwap(false, true) { |
| 39 | close(e.c) |
| 40 | return true |
| 41 | } |
| 42 | return false |
| 43 | } |
| 44 | |
| 45 | // Done returns a channel that will be closed when Fire is called. |
| 46 | func (e *Event) Done() <-chan struct{} { |
no outgoing calls