This pull request includes needed changes to get started using locking annotations. threadsafety.h - the set of macros. sync.h - a mixin that adds annotations to the basic locks. net.h - I added annotations to functions where the set of held locks before and after the function is called is not the same.
Reviewers: Please look carefully at the TODOs in net.h. The pre/postconditions of those functions are entirely unclear. The set of held locks depend on the value of nHeaderStart ! nHeaderStart is also involved in both != -1 and < 0 tests.