all: replace RWMutex with Mutex in places where RLock is not used (#21622)

This commit is contained in:
Daniel Liu 2025-01-14 10:56:11 +08:00
parent 5b48621c36
commit d8c9ad3c9f
5 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ import (
type fileCache struct {
all mapset.Set // Set of all files from the keystore folder
lastMod time.Time // Last time instance when a file was modified
mu sync.RWMutex
mu sync.Mutex
}
// scan performs a new scan on the given directory, compares against the already

View file

@ -86,7 +86,7 @@ type ChainIndexer struct {
throttling time.Duration // Disk throttling to prevent a heavy upgrade from hogging resources
log log.Logger
lock sync.RWMutex
lock sync.Mutex
}
// NewChainIndexer creates a new chain indexer to do background processing on

View file

@ -145,7 +145,7 @@ type Downloader struct {
cancelLock sync.RWMutex // Lock to protect the cancel channel and peer in delivers
quitCh chan struct{} // Quit channel to signal termination
quitLock sync.RWMutex // Lock to prevent double closes
quitLock sync.Mutex // Lock to prevent double closes
// Testing hooks
syncInitHook func(uint64, uint64) // Method to call upon initiating a new sync run

View file

@ -34,7 +34,7 @@ type LesTxRelay struct {
ps *peerSet
peerList []*peer
peerStartPos int
lock sync.RWMutex
lock sync.Mutex
reqDist *requestDistributor
}

View file

@ -47,7 +47,7 @@ type unconfirmedBlocks struct {
chain headerRetriever // Blockchain to verify canonical status through
depth uint // Depth after which to discard previous blocks
blocks *ring.Ring // Block infos to allow canonical chain cross checks
lock sync.RWMutex // Protects the fields from concurrent access
lock sync.Mutex // Protects the fields from concurrent access
}
// newUnconfirmedBlocks returns new data structure to track currently unconfirmed blocks.