Use atomic load for CPU agent's hash rate

This commit is contained in:
Gustav Simonsson 2015-05-13 21:59:46 +02:00
parent 7a25ecfa1f
commit 773fcd801c

View file

@ -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)
}