move mutex before select
This commit is contained in:
parent
e1c9c4297b
commit
69ebd2bb85
@ -91,12 +91,13 @@ func (m *Miner) Start(ctx context.Context) error {
|
||||
|
||||
func (m *Miner) Stop(ctx context.Context) error {
|
||||
m.lk.Lock()
|
||||
defer m.lk.Unlock()
|
||||
|
||||
m.stopping = make(chan struct{})
|
||||
stopping := m.stopping
|
||||
close(m.stop)
|
||||
|
||||
m.lk.Unlock()
|
||||
|
||||
select {
|
||||
case <-stopping:
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user