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: https://github.com/microsoft/STL/commit/539c26c923b38cd0b5eba2bb11de4bea9d5c6e43
This commit is contained in:
1 file changed
+1
-2
+1
-2
@@ -165,8 +165,7 @@ private:
|
|||||||
bool TryEnter(const char* pszName, const char* pszFile, int nLine)
|
bool TryEnter(const char* pszName, const char* pszFile, int nLine)
|
||||||
{
|
{
|
||||||
EnterCritical(pszName, pszFile, nLine, Base::mutex(), true);
|
EnterCritical(pszName, pszFile, nLine, Base::mutex(), true);
|
||||||
Base::try_lock();
|
if (!Base::try_lock()) {
|
||||||
if (!Base::owns_lock()) {
|
|
||||||
LeaveCritical();
|
LeaveCritical();
|
||||||
}
|
}
|
||||||
return Base::owns_lock();
|
return Base::owns_lock();
|
||||||
|
|||||||
Reference in new issue
Block a user