miner: use channels instead of atomics in update loop (#21536)
This PR changes several different things: - Adds test cases for the miner loop - Stops the worker if it wasn't already stopped in worker.Close() - Uses channels instead of atomics in the miner.update() loop Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
committed by
GitHub
parent
d7f02b448a
commit
7cf56d6f06
@ -303,6 +303,7 @@ func (w *worker) isRunning() bool {
|
||||
// close terminates all background threads maintained by the worker.
|
||||
// Note the worker does not support being closed multiple times.
|
||||
func (w *worker) close() {
|
||||
atomic.StoreInt32(&w.running, 0)
|
||||
close(w.exitCh)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user