aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-09-23 16:36:52 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-09-23 16:37:07 +0200
commit8235dca6210dab8e9657c0b592ab928554155082 (patch)
treef8dd8b710ca9e4905c0890990a71a6c777807fde /src/net.h
parent9e217f5a6f08c50aff9975aa4c079e2aab2fe371 (diff)
parent0bd1184adf6610c0bd14f4e9a25c0a200e65ae25 (diff)
downloadbitcoin-8235dca6210dab8e9657c0b592ab928554155082.tar.xz
Merge #19979: Replace LockAssertion with AssertLockHeld, remove LockAssertion
0bd1184adf6610c0bd14f4e9a25c0a200e65ae25 Remove unused LockAssertion struct (Hennadii Stepanov) ab2a44297fd0796bf5797ae2a477e8e56d9c3c12 Replace LockAssertion with a proper thread safety annotations (Hennadii Stepanov) 73f71e19965e07534eb47701f2b23c9ed59ef475 refactor: Use explicit function type instead of template (Hennadii Stepanov) Pull request description: This PR replaces `LockAssertion` with `AssertLockHeld`, and removes `LockAssertion`. This PR is compared with alternatives in https://github.com/bitcoin-core/bitcoin-devwiki/wiki/AssertLockHeld-PRs ACKs for top commit: MarcoFalke: ACK 0bd1184adf6610c0bd14f4e9a25c0a200e65ae25 ajtowns: ACK 0bd1184adf6610c0bd14f4e9a25c0a200e65ae25 vasild: ACK 0bd1184ad Tree-SHA512: ef7780dd689faf0bb479fdb97c49bc652e2dd10c148234bb95502dfbb676442d8565ee37864d923ca21a25f9dc2a335bf46ee82c095e387b59a664ab05c0ae41
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/net.h b/src/net.h
index 0366fa0f5b..62167014ff 100644
--- a/src/net.h
+++ b/src/net.h
@@ -258,8 +258,8 @@ public:
void PushMessage(CNode* pnode, CSerializedNetMsg&& msg);
- template<typename Callable>
- void ForEachNode(Callable&& func)
+ using NodeFn = std::function<void(CNode*)>;
+ void ForEachNode(const NodeFn& func)
{
LOCK(cs_vNodes);
for (auto&& node : vNodes) {
@@ -268,8 +268,7 @@ public:
}
};
- template<typename Callable>
- void ForEachNode(Callable&& func) const
+ void ForEachNode(const NodeFn& func) const
{
LOCK(cs_vNodes);
for (auto&& node : vNodes) {