evcc-io/core/loadpoint_mutex.go
2026-05-05 08:43:23 +02:00

33 lines
509 B
Go

package core
import (
"testing"
)
func (lp *Loadpoint) RLock() {
if testing.Testing() && lp.rwMutex.Add(1) > 1 {
panic("reentrant RLock")
}
lp.RWMutex.RLock()
}
func (lp *Loadpoint) RUnlock() {
if testing.Testing() {
lp.rwMutex.Add(-1)
}
lp.RWMutex.RUnlock()
}
func (lp *Loadpoint) Lock() {
if testing.Testing() && lp.rwMutex.Add(1) > 1 {
panic("reentrant Lock")
}
lp.RWMutex.Lock()
}
func (lp *Loadpoint) Unlock() {
if testing.Testing() {
lp.rwMutex.Add(-1)
}
lp.RWMutex.Unlock()
}