sync.h: Imply negative assertions when calling LOCK
Summary:
This is a partial backport of core#24931
https://github.com/bitcoin/bitcoin/pull/24931/commits/d2852917eecad6ab422a7b2c9892d351a7f0cc96
Depends on D14893
Test Plan:
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ninja all check-alli
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D14894