mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
* 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>
15 lines
526 B
Go
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()
|
|
}
|