[sanitizer] more code for deadlock detector, nothing really works yet (except for small unit tests).