Skip to content

Commit

Permalink
all: replace RWMutex with Mutex in places where RLock is not used #21622
Browse files Browse the repository at this point in the history
  • Loading branch information
niuxiaojie81 committed Aug 24, 2021
1 parent 1ed371f commit 352a41e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions accounts/keystore/file_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import (
"sync"
"time"

mapset "github.com/deckarep/golang-set"
"github.com/AlayaNetwork/Alaya-Go/log"
mapset "github.com/deckarep/golang-set"
)

// fileCache is a cache of files seen during scan of keystore.
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
Expand Down
2 changes: 1 addition & 1 deletion core/chain_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,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
Expand Down
2 changes: 1 addition & 1 deletion les/txrelay.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type LesTxRelay struct {
ps *peerSet
peerList []*peer
peerStartPos int
lock sync.RWMutex
lock sync.Mutex

reqDist *requestDistributor
}
Expand Down
2 changes: 1 addition & 1 deletion miner/unconfirmed.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type unconfirmedBlocks struct {
chain chainRetriever // 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.
Expand Down

0 comments on commit 352a41e

Please sign in to comment.