mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Remove unused LockAssertion struct
This commit is contained in:
parent
ab2a44297f
commit
0bd1184adf
2 changed files with 0 additions and 33 deletions
|
@ -793,25 +793,6 @@ bool ChainstateManager::ProcessNewBlock(...)
|
|||
}
|
||||
```
|
||||
|
||||
- When Clang Thread Safety Analysis is unable to determine if a mutex is locked, use `LockAssertion` class instances:
|
||||
|
||||
```C++
|
||||
// net_processing.h
|
||||
void RelayTransaction(...) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
// net_processing.cpp
|
||||
void RelayTransaction(...)
|
||||
{
|
||||
AssertLockHeld(::cs_main);
|
||||
|
||||
connman.ForEachNode([&txid, &wtxid](CNode* pnode) {
|
||||
LockAssertion lock(::cs_main);
|
||||
...
|
||||
});
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
- Build and run tests with `-DDEBUG_LOCKORDER` to verify that no potential
|
||||
deadlocks are introduced. As of 0.12, this is defined by default when
|
||||
configuring with `--enable-debug`.
|
||||
|
|
14
src/sync.h
14
src/sync.h
|
@ -352,18 +352,4 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// Utility class for indicating to compiler thread analysis that a mutex is
|
||||
// locked (when it couldn't be determined otherwise).
|
||||
struct SCOPED_LOCKABLE LockAssertion
|
||||
{
|
||||
template <typename Mutex>
|
||||
explicit LockAssertion(Mutex& mutex) EXCLUSIVE_LOCK_FUNCTION(mutex)
|
||||
{
|
||||
#ifdef DEBUG_LOCKORDER
|
||||
AssertLockHeld(mutex);
|
||||
#endif
|
||||
}
|
||||
~LockAssertion() UNLOCK_FUNCTION() {}
|
||||
};
|
||||
|
||||
#endif // BITCOIN_SYNC_H
|
||||
|
|
Loading…
Add table
Reference in a new issue