Browse Source

fixes #1; events.go: claim full lock on delete listener

pull/1842/head
Benjamin Bollen 9 years ago
parent
commit
c15bcd487f
No known key found for this signature in database GPG Key ID: F78AD719FBEAF215
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      events.go

+ 4
- 2
events.go View File

@ -74,13 +74,15 @@ func (evsw *EventSwitch) RemoveListener(listenerID string) {
// Get and remove listener
evsw.mtx.RLock()
listener := evsw.listeners[listenerID]
delete(evsw.listeners, listenerID)
evsw.mtx.RUnlock()
if listener == nil {
return
}
evsw.mtx.Lock()
delete(evsw.listeners, listenerID)
evsw.mtx.Unlock()
// Remove callback for each event.
listener.SetRemoved()
for _, event := range listener.GetEvents() {


Loading…
Cancel
Save