Lock before checking if orphan_work_set is empty; indicate it is guarded
Summary:
This is a backport of core#19911 [3/6]
https://github.com/bitcoin/bitcoin/pull/19911/commits/673247b58cd1252ab7e99f7d63ead05cc100cef2
Depends on D10527
Test Plan:
cmake .. -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=thread ninja && ninja check check-functional
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10528