From c981cd44ce2601754134d913c092397ca4f49ee8 Mon Sep 17 00:00:00 2001 From: georgehao Date: Tue, 4 Feb 2025 17:47:41 +0800 Subject: [PATCH] add panic log to Close --- internal/syncx/mutex.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/syncx/mutex.go b/internal/syncx/mutex.go index 0fc100895f..9e84a893c3 100644 --- a/internal/syncx/mutex.go +++ b/internal/syncx/mutex.go @@ -65,7 +65,10 @@ func (cm *ClosableMutex) Unlock() { // Close locks the mutex, then closes it. func (cm *ClosableMutex) Close() { select { - case <-cm.ch: + case _, ok := <-cm.ch: + if !ok { + panic("Close of already-closed ClosableMutex") + } default: } close(cm.ch)