Skip to content

Commit

Permalink
fix(queue): fix deadlock conditional when Close()
Browse files Browse the repository at this point in the history
  • Loading branch information
Planxnx committed Oct 23, 2023
1 parent 89774b3 commit fedfe6d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ func (q *Queue[T]) Dequeue() (val T, ok bool) {
q.mu.Lock()
defer q.mu.Unlock()

if q.isClosed {
return val, false
}

for len(q.items) == 0 {
if q.isClosed {
return val, false
}
q.cond.Wait()
}

Expand Down

0 comments on commit fedfe6d

Please sign in to comment.