mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Use atomic load for CPU agent's hash rate
This commit is contained in:
parent
7a25ecfa1f
commit
773fcd801c
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package miner
|
|||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
@ -98,5 +99,5 @@ func (self *CpuAgent) mine(block *types.Block) {
|
|||
}
|
||||
|
||||
func (self *CpuAgent) GetHashRate() uint64 {
|
||||
return *self.prevHashRate
|
||||
return atomic.LoadUint64(self.prevHashRate)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue