diff options
author | Valery Piashchynski <[email protected]> | 2020-12-17 03:44:16 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-17 03:44:16 +0300 |
commit | 26c6e2c481921760f0f2cc98fdbb022ed1c54a48 (patch) | |
tree | 4172caf588eda988c24d0793acc9380c52b2d6fd /util | |
parent | 2d5a042cd4c80b1989b8235a7412110d435b1130 (diff) |
Fix deadlock
Diffstat (limited to 'util')
-rwxr-xr-x | util/events.go | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/util/events.go b/util/events.go index 676e2f40..259c7ddb 100755 --- a/util/events.go +++ b/util/events.go @@ -1,15 +1,12 @@ package util import ( - "sync" - "github.com/spiral/roadrunner/v2/interfaces/events" ) // EventHandler helps to broadcast events to multiple listeners. type EventHandler struct { listeners []events.EventListener - sync.Mutex } func NewEventsHandler() events.Handler { @@ -18,22 +15,16 @@ func NewEventsHandler() events.Handler { // NumListeners returns number of event listeners. func (eb *EventHandler) NumListeners() int { - eb.Lock() - defer eb.Unlock() return len(eb.listeners) } // AddListener registers new event listener. func (eb *EventHandler) AddListener(listener events.EventListener) { - eb.Lock() - defer eb.Unlock() eb.listeners = append(eb.listeners, listener) } // Push broadcast events across all event listeners. func (eb *EventHandler) Push(e interface{}) { - eb.Lock() - defer eb.Unlock() for _, listener := range eb.listeners { listener(e) } |