Stop stops the dispatcher and drains the queue.
()
| 202 | |
| 203 | // Stop stops the dispatcher and drains the queue. |
| 204 | func (m *Manager) Stop() { |
| 205 | if m == nil { |
| 206 | return |
| 207 | } |
| 208 | m.stopOnce.Do(func() { |
| 209 | if m.cancel != nil { |
| 210 | m.cancel() |
| 211 | } |
| 212 | m.mu.Lock() |
| 213 | m.closed = true |
| 214 | m.mu.Unlock() |
| 215 | m.cond.Broadcast() |
| 216 | }) |
| 217 | } |
| 218 | |
| 219 | // Register appends a plugin to the delivery list. |
| 220 | func (m *Manager) Register(plugin Plugin) { |