mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-05 09:14:28 +00:00
2a7a09b112
* add lock analyzer * fix locks * progress * fix failures * fix error log Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
27 lines
906 B
Go
27 lines
906 B
Go
// These are all non recursive rlocks. Testing to make sure there are no false positives
|
|
package testdata
|
|
|
|
func (resource *ProtectResource) NestedRLockWithDefer() string {
|
|
resource.RLock()
|
|
defer resource.RUnlock()
|
|
return resource.GetResource() // want `found recursive read lock call`
|
|
}
|
|
|
|
func (resource *NestedProtectResource) NonNestedRLockDifferentRLocks() {
|
|
resource.RLock()
|
|
resource.GetNestedPResource() // get nested resource uses RLock, but at a deeper level in the struct
|
|
resource.RUnlock()
|
|
}
|
|
|
|
func (resource *ProtectResource) NestedLockWithDefer() string {
|
|
resource.Lock()
|
|
defer resource.Unlock()
|
|
return resource.GetResourceLocked() // want `found recursive lock call`
|
|
}
|
|
|
|
func (resource *NestedProtectResource) NonNestedLockDifferentLocks() {
|
|
resource.Lock()
|
|
resource.GetNestedPResourceLocked() // get nested resource uses RLock, but at a deeper level in the struct
|
|
resource.Unlock()
|
|
}
|