mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
add panic log to Close
This commit is contained in:
parent
d875add9c7
commit
c981cd44ce
1 changed files with 4 additions and 1 deletions
|
|
@ -65,7 +65,10 @@ func (cm *ClosableMutex) Unlock() {
|
||||||
// Close locks the mutex, then closes it.
|
// Close locks the mutex, then closes it.
|
||||||
func (cm *ClosableMutex) Close() {
|
func (cm *ClosableMutex) Close() {
|
||||||
select {
|
select {
|
||||||
case <-cm.ch:
|
case _, ok := <-cm.ch:
|
||||||
|
if !ok {
|
||||||
|
panic("Close of already-closed ClosableMutex")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
close(cm.ch)
|
close(cm.ch)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue