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() {
|
func (s *state[T]) Close() {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
if s.closed {
|
if s.closed {
|
||||||
|
s.mu.Unlock()
|
||||||
panic("close of closed queue")
|
panic("close of closed queue")
|
||||||
}
|
}
|
||||||
s.closed = true
|
s.closed = true
|
||||||
|
@ -93,6 +93,7 @@ type state[P constraints.Integer, T any] struct {
|
|||||||
func (s *state[P, T]) Close() {
|
func (s *state[P, T]) Close() {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
if s.closed {
|
if s.closed {
|
||||||
|
s.mu.Unlock()
|
||||||
panic("close of closed queue")
|
panic("close of closed queue")
|
||||||
}
|
}
|
||||||
s.closed = true
|
s.closed = true
|
||||||
|
@ -61,6 +61,7 @@ type state[P constraints.Ordered, T any] struct {
|
|||||||
func (s *state[P, T]) Close() {
|
func (s *state[P, T]) Close() {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
if s.closed {
|
if s.closed {
|
||||||
|
s.mu.Unlock()
|
||||||
panic("close of closed queue")
|
panic("close of closed queue")
|
||||||
}
|
}
|
||||||
s.closed = true
|
s.closed = true
|
||||||
|
Loading…
Reference in New Issue
Block a user