mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
refactor: Do not discard try_lock()
return value
Microsoft's C++ Standard Library uses the `[[nodiscard]]` attribute for
`try_lock()`.
See: https://github.com/microsoft/STL/blob/main/stl/inc/mutex
This change allows to drop the current suppression for the warning C4838
and helps to prevent the upcoming warning C4858.
See: 539c26c923
This commit is contained in:
parent
9fcdb9f3a0
commit
bff4e068b6
@ -165,8 +165,7 @@ private:
|
||||
bool TryEnter(const char* pszName, const char* pszFile, int nLine)
|
||||
{
|
||||
EnterCritical(pszName, pszFile, nLine, Base::mutex(), true);
|
||||
Base::try_lock();
|
||||
if (!Base::owns_lock()) {
|
||||
if (!Base::try_lock()) {
|
||||
LeaveCritical();
|
||||
}
|
||||
return Base::owns_lock();
|
||||
|
Loading…
Reference in New Issue
Block a user