(id string)
| 91 | } |
| 92 | |
| 93 | func (h *Handler) unregister(id string) { |
| 94 | h.notifyMutex.Lock() |
| 95 | defer h.notifyMutex.Unlock() |
| 96 | |
| 97 | newNotify := []notify{} |
| 98 | for _, n := range h.notify { |
| 99 | if id == n.id { |
| 100 | continue |
| 101 | } |
| 102 | |
| 103 | newNotify = append(newNotify, n) |
| 104 | } |
| 105 | h.notify = newNotify |
| 106 | } |
| 107 | |
| 108 | // Run ensures that the function fn is run and runs the notify function if interrupted meanwhile |
| 109 | func (h *Handler) Run(fn func() error, notify func()) error { |