mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Merge bitcoin/bitcoin#26189: refactor: Do not discard try_lock()
return value
30cc1c6609
refactor: Drop `owns_lock()` call (Hennadii Stepanov)bff4e068b6
refactor: Do not discard `try_lock()` return value (Hennadii Stepanov) Pull request description: 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
Fixes bitcoin/bitcoin#26017. Split from bitcoin/bitcoin#25819. ACKs for top commit: vasild: ACK30cc1c6609
Tree-SHA512: ce17404e1c78af4f763129753caf8e5a0e1c91ba398778fe912f9fcc56a847e8112460d1a1a35bf905a593b7d8e0b16c6b099ad74976b67dca5f4f3eda6ff621
This commit is contained in:
commit
1730f6cb23
1 changed files with 4 additions and 4 deletions
|
@ -165,11 +165,11 @@ 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()) {
|
||||
LeaveCritical();
|
||||
if (Base::try_lock()) {
|
||||
return true;
|
||||
}
|
||||
return Base::owns_lock();
|
||||
LeaveCritical();
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Reference in a new issue