diff --git a/queue/queue.go b/queue/queue.go index 8d0cc79..273c712 100644 --- a/queue/queue.go +++ b/queue/queue.go @@ -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() }