Skip to content

Commit

Permalink
with loop gone, better to defer the mtx unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Apr 5, 2023
1 parent ec9b072 commit b8eaded
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions mixing/mixpool/mixpool.go
Expand Up @@ -345,10 +345,9 @@ func (p *Pool) Receive(ctx context.Context, r *Received) error {
}

p.mtx.RLock()
defer p.mtx.RUnlock()

if run >= uint32(len(ses.runs)) {
p.mtx.RUnlock()

if err != nil {
return err
}
Expand Down Expand Up @@ -384,8 +383,6 @@ func (p *Pool) Receive(ctx context.Context, r *Received) error {
}
}

p.mtx.RUnlock()

return err
}

Expand Down

0 comments on commit b8eaded

Please sign in to comment.