Unlock() before panic() when already closed.
This commit is contained in:
parent
9d1228988d
commit
a20c8908de
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user