mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
storage: use pointer to mutex instead of value
This commit is contained in:
parent
094e71721f
commit
a344c2fbf6
1 changed files with 7 additions and 2 deletions
|
|
@ -178,7 +178,7 @@ type Chunk struct {
|
|||
ReqC chan bool // to signal the request done
|
||||
dbStoredC chan bool // never remove a chunk from memStore before it is written to dbStore
|
||||
dbStored bool
|
||||
dbStoredMu sync.Mutex
|
||||
dbStoredMu *sync.Mutex
|
||||
errored bool // flag which is set when the chunk request has errored or timeouted
|
||||
erroredMu sync.Mutex
|
||||
}
|
||||
|
|
@ -198,7 +198,12 @@ func (c *Chunk) GetErrored() bool {
|
|||
}
|
||||
|
||||
func NewChunk(key Key, reqC chan bool) *Chunk {
|
||||
return &Chunk{Key: key, ReqC: reqC, dbStoredC: make(chan bool)}
|
||||
return &Chunk{
|
||||
Key: key,
|
||||
ReqC: reqC,
|
||||
dbStoredC: make(chan bool),
|
||||
dbStoredMu: &sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Chunk) markAsStored() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue