mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
libs: wrap mutexes for build flag with godeadlock (#5126)
## Description This PR wraps the stdlib sync.(RW)Mutex & godeadlock.(RW)Mutex. This enables using go-deadlock via a build flag instead of using sed to replace sync with godeadlock in all files Closes: #3242
This commit is contained in:
@@ -3,9 +3,9 @@ package events
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/service"
|
||||
tmsync "github.com/tendermint/tendermint/libs/sync"
|
||||
)
|
||||
|
||||
// ErrListenerWasRemoved is returned by AddEvent if the listener was removed.
|
||||
@@ -54,7 +54,7 @@ type EventSwitch interface {
|
||||
type eventSwitch struct {
|
||||
service.BaseService
|
||||
|
||||
mtx sync.RWMutex
|
||||
mtx tmsync.RWMutex
|
||||
eventCells map[string]*eventCell
|
||||
listeners map[string]*eventListener
|
||||
}
|
||||
@@ -162,7 +162,7 @@ func (evsw *eventSwitch) FireEvent(event string, data EventData) {
|
||||
|
||||
// eventCell handles keeping track of listener callbacks for a given event.
|
||||
type eventCell struct {
|
||||
mtx sync.RWMutex
|
||||
mtx tmsync.RWMutex
|
||||
listeners map[string]EventCallback
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ type EventCallback func(data EventData)
|
||||
type eventListener struct {
|
||||
id string
|
||||
|
||||
mtx sync.RWMutex
|
||||
mtx tmsync.RWMutex
|
||||
removed bool
|
||||
events []string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user