Files
prysm/tools/analyzers/recursivelock/testdata/nonrlocks.go
Chase Jeter 0ea4b02b8b Added analyzer for detecting recursive/nested mutex read locks. (#10066)
* Added analyzer for detecting recursive/nested mutex read locks.

* Added type assertion checks and removed unused 'iTypes' directory

* Clean up

* Bazel file fixes

* Cleaned up code and added comments.

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2022-01-14 17:12:21 +08:00

15 lines
526 B
Go

// These are all non recursive rlocks. Testing to make sure there are no false positives
package testdata
func (resource *ProtectResource) NonNestedRLockWithDefer() string {
resource.RLock()
defer resource.RUnlock()
return resource.GetResource() // this is not a nested rlock because runlock is deferred
}
func (resource *NestedProtectResource) NonNestedRLockDifferentRLocks() {
resource.RLock()
resource.GetNestedPResource() // get nested resource uses RLock, but at a deeper level in the struct
resource.RUnlock()
}