bitcoin/src/util
MarcoFalke 55b4c65bd1
Merge #16127: More thread safety annotation coverage
5478d6c099 logging: thread safety annotations (Anthony Towns)
e685ca1992 util/system.cpp: add thread safety annotations for dir_locks (Anthony Towns)
a788789948 test/checkqueue_tests: thread safety annotations (Anthony Towns)
479c5846f7 rpc/blockchain.cpp: thread safety annotations for latestblock (Anthony Towns)
8b5af3d4c1 net: fMsgProcWake use LOCK instead of lock_guard (Anthony Towns)
de7c5f41ab wallet/wallet.h: Remove mutexScanning which was only protecting a single atomic bool (Anthony Towns)
c3cf2f5501 rpc/blockchain.cpp: Remove g_utxosetscan mutex that is only protecting a single atomic variable (Anthony Towns)

Pull request description:

  In a few cases we need to use `std::mutex` rather than the sync.h primitives. But `std::lock_guard<std::mutex>` doesn't include the clang thread safety annotations unless you also use clang's C library, which means you can't indicate when variables should be guarded by `std::mutex` mutexes.

  This adds an annotated version of `std::lock_guard<std::mutex>` to threadsafety.h to fix that, and modifies places where `std::mutex` is used to take advantage of the annotations.

  It's based on top of #16112, and turns the thread safety comments included there into annotations.

  It also changes the RAII classes in wallet/wallet.h and rpc/blockchain.cpp to just use the atomic<bool> flag for synchronisation rather than having a mutex that doesn't actually guard anything as well.

ACKs for top commit:
  MarcoFalke:
    ACK 5478d6c099 🗾
  hebasto:
    re-ACK 5478d6c099, only renamed s/`MutexGuard`/`LockGuard`/, and dropped the commit "test/util_threadnames_tests: add thread safety annotations" since the [previous](https://github.com/bitcoin/bitcoin/pull/16127#pullrequestreview-414184113) review.
  ryanofsky:
    Code review ACK 5478d6c099. Thanks for taking suggestions! Only changes since last review are dropping thread rename test commit d53072ec730d8eec5a5b72f7e65a54b141e62b19 and renaming mutex guard to lock guard

Tree-SHA512: 7b00d31f6f2b5a222ec69431eb810a74abf0542db3a65d1bbad54e354c40df2857ec89c00b4a5e466c81ba223267ca95f3f98d5fbc1a1d052a2c3a7d2209790a
2020-05-27 19:31:33 -04:00
..
asmap.cpp refactor: Rework asmap Interpret to avoid ptrdiff_t 2020-05-09 00:20:00 -07:00
asmap.h Add asmap sanity checker 2020-04-08 16:26:06 -07:00
bip32.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
bip32.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
bytevectorhash.cpp blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
bytevectorhash.h blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
check.h Add util::Ref class as temporary alternative for c++17 std::any 2020-05-13 16:20:13 -04:00
error.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
error.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
fees.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
fees.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
golombrice.h tests: Add fuzzing harness for Golomb-Rice coding (GolombRiceEncode/GolombRiceDecode) 2020-04-20 14:57:48 +00:00
macros.h refactor: consolidate PASTE macros 2019-09-25 10:56:00 -04:00
memory.h scripted-diff: Move util files to separate directory. 2018-11-04 22:46:07 -08:00
message.cpp Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan 2020-03-09 11:16:20 -04:00
message.h Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan 2020-03-09 11:16:20 -04:00
moneystr.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
moneystr.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
rbf.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
rbf.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
ref.h Add util::Ref class as temporary alternative for c++17 std::any 2020-05-13 16:20:13 -04:00
settings.cpp refactor: Remove null setting check in GetSetting() 2019-11-13 15:23:06 -05:00
settings.h util: Document why ArgsManager (con/de)structor is not inline 2020-04-16 12:26:09 -04:00
spanparsing.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
spanparsing.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
strencodings.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
strencodings.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
string.cpp util: Add Join helper to join a list of strings 2019-08-20 16:51:41 -04:00
string.h util: Enhance Join() 2020-05-10 18:00:19 +03:00
system.cpp util/system.cpp: add thread safety annotations for dir_locks 2020-05-26 23:23:15 +10:00
system.h Merge #17509: gui: save and load PSBT 2020-04-23 13:16:23 +12:00
threadnames.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
threadnames.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
time.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
time.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
translation.h util: Drop OpOriginal() and OpTranslated() 2020-05-10 21:28:29 +03:00
url.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
url.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
vector.h Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00