mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +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
|
ReqC chan bool // to signal the request done
|
||||||
dbStoredC chan bool // never remove a chunk from memStore before it is written to dbStore
|
dbStoredC chan bool // never remove a chunk from memStore before it is written to dbStore
|
||||||
dbStored bool
|
dbStored bool
|
||||||
dbStoredMu sync.Mutex
|
dbStoredMu *sync.Mutex
|
||||||
errored bool // flag which is set when the chunk request has errored or timeouted
|
errored bool // flag which is set when the chunk request has errored or timeouted
|
||||||
erroredMu sync.Mutex
|
erroredMu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +198,12 @@ func (c *Chunk) GetErrored() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewChunk(key Key, reqC chan bool) *Chunk {
|
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() {
|
func (c *Chunk) markAsStored() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue