aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-23 18:43:37 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-23 18:45:26 +0200
commitd2464dfee928cdd4194516e9bc8b541c22972ab9 (patch)
tree19021d0c8d5bf2cd672b4e127e93e489606e98e7 /src/main.cpp
parentd946e9a848b82873881cd48267041081be8424c5 (diff)
parenta794284e61988a226ea39327449be9906a1b5abd (diff)
downloadbitcoin-d2464dfee928cdd4194516e9bc8b541c22972ab9.tar.xz
Merge pull request #6287
a794284 locking: add a quick example of GUARDED_BY (Cory Fields) 2b890dd locking: fix a few small issues uncovered by -Wthread-safety (Cory Fields) cd27bba locking: teach Clang's -Wthread-safety to cope with our scoped lock macros (Cory Fields)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fb90d7578c..54f9f89c4d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -75,9 +75,9 @@ struct COrphanTx {
CTransaction tx;
NodeId fromPeer;
};
-map<uint256, COrphanTx> mapOrphanTransactions;
-map<uint256, set<uint256> > mapOrphanTransactionsByPrev;
-void EraseOrphansFor(NodeId peer);
+map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(cs_main);;
+map<uint256, set<uint256> > mapOrphanTransactionsByPrev GUARDED_BY(cs_main);;
+void EraseOrphansFor(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
/**
* Returns true if there are nRequired or more blocks of minVersion or above
@@ -527,7 +527,7 @@ CBlockTreeDB *pblocktree = NULL;
// mapOrphanTransactions
//
-bool AddOrphanTx(const CTransaction& tx, NodeId peer)
+bool AddOrphanTx(const CTransaction& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
uint256 hash = tx.GetHash();
if (mapOrphanTransactions.count(hash))
@@ -557,7 +557,7 @@ bool AddOrphanTx(const CTransaction& tx, NodeId peer)
return true;
}
-void static EraseOrphanTx(uint256 hash)
+void static EraseOrphanTx(uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.find(hash);
if (it == mapOrphanTransactions.end())
@@ -591,7 +591,7 @@ void EraseOrphansFor(NodeId peer)
}
-unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
+unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
unsigned int nEvicted = 0;
while (mapOrphanTransactions.size() > nMaxOrphans)
@@ -3649,7 +3649,7 @@ std::string GetWarnings(const std::string& strFor)
//
-bool static AlreadyHave(const CInv& inv)
+bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
switch (inv.type)
{