Mitigate double read locks on the layered profile

This commit is contained in:
Daniel
2022-08-02 13:59:13 +02:00
parent 0390ab55ab
commit 0b81fb5516
5 changed files with 27 additions and 14 deletions

View File

@@ -168,6 +168,17 @@ func (lp *LayeredProfile) LocalProfile() *Profile {
return lp.localProfile
}
// LocalProfileWithoutLocking returns the local profile associated with this
// layered profile, but without locking the layered profile.
// This method my only be used when the caller already has a lock on the layered profile.
func (lp *LayeredProfile) LocalProfileWithoutLocking() *Profile {
if lp == nil {
return nil
}
return lp.localProfile
}
// increaseRevisionCounter increases the revision counter and pushes the
// layered profile to listeners.
func (lp *LayeredProfile) increaseRevisionCounter(lock bool) (revisionCounter uint64) { //nolint:unparam // This is documentation.