MCPcopy
hub / github.com/google/gvisor / testConsistentBranching

Function testConsistentBranching

tools/checklocks/test/branches.go:27–40  ·  view source on GitHub ↗
(tc *oneGuardStruct)

Source from the content-addressed store, hash-verified

25}
26
27func testConsistentBranching(tc *oneGuardStruct) {
28 x := rand.Intn(10)
29 if x%2 == 1 {
30 tc.mu.Lock()
31 } else {
32 tc.mu.Lock()
33 }
34 tc.guardedField = 1
35 if x%2 == 1 {
36 tc.mu.Unlock()
37 } else {
38 tc.mu.Unlock()
39 }
40}
41
42func testInconsistentBranching(tc *oneGuardStruct) { // +checklocksfail=incompatible return states|incompatible return states
43 // We traverse the control flow graph in all consistent ways. We cannot

Callers

nothing calls this directly

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…