Double Lock Checker
Closed this issue · 1 comments
Tengfei1010 commented
Double lock:
Phase 1: A function acquires a lock twice!
func f1() {
.....
r.Lock() // rw.Rlock()
..... # no unlock and they may be not in same block.
r.Lock() // rw.Lock()
}
Phase 2: Another double lock:
The parent function has already acquired the lock and the child function wants to acquire the lock.
func f1() {
r.Lock()
..... // no unlock
call f2() // may be call f1->f3->......->f2
....
}
func f2() {
......
r.Lock()
......
}
Phase 3: Third double lock:
The lock in a loop.....
func f1() {
for {
r.lock()
.......
}
}
Tengfei1010 commented
Finish the Phase 1