Constructs like
0AssertLockNotHeld(m);
1LOCK(m);
are equivalent to (almost, modulo some logging differences, see below)
0LOCK(m);
for non-recursive mutexes, so it is ok to omit AssertLockNotHeld()
in such cases. Requests to do the former keep coming during review process. developer-notes.md
explicitly states “Combine annotations in function declarations with run-time asserts in function definitions”, but that seems to be too strong or unclear. LOCK()
is also a run-time assert in this case.
Also remove LocksHeld()
from the public interface in sync.h
since it is only used in sync.cpp
.