diff --git a/mq/lib.go b/mq/lib.go index 4686a21..f93bda3 100644 --- a/mq/lib.go +++ b/mq/lib.go @@ -73,6 +73,7 @@ type state[T any] struct { func (s *state[T]) Close() { s.mu.Lock() if s.closed { + s.mu.Unlock() panic("close of closed queue") } s.closed = true diff --git a/npq/lib.go b/npq/lib.go index 6496397..2e0d79f 100644 --- a/npq/lib.go +++ b/npq/lib.go @@ -93,6 +93,7 @@ type state[P constraints.Integer, T any] struct { func (s *state[P, T]) Close() { s.mu.Lock() if s.closed { + s.mu.Unlock() panic("close of closed queue") } s.closed = true diff --git a/pq/lib.go b/pq/lib.go index d69dcf5..8f45a8f 100644 --- a/pq/lib.go +++ b/pq/lib.go @@ -61,6 +61,7 @@ type state[P constraints.Ordered, T any] struct { func (s *state[P, T]) Close() { s.mu.Lock() if s.closed { + s.mu.Unlock() panic("close of closed queue") } s.closed = true