add panic log to Close

This commit is contained in:
georgehao 2025-02-04 17:47:41 +08:00
parent d875add9c7
commit c981cd44ce
No known key found for this signature in database

View file

@ -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)