util: Use try_lock return value in UniqueLock::TryEnter #17707

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2019_12_try_lock_returnval changing 1 files +3 −3
  1. laanwj commented at 3:15 AM on December 10, 2019: member

    If I understand http://www.cplusplus.com/reference/mutex/unique_lock/try_lock/ and https://en.cppreference.com/w/cpp/thread/mutex/try_lock correctly, the return value if try_lock already signifies whether the locking was succesful, there is no need to call Base::owns_lock (http://www.cplusplus.com/reference/mutex/unique_lock/owns_lock/) to check.

    Should get rid of the following MSVC warning in AppVeyor: "warning C4834: discarding return value of function with 'nodiscard' attribute"

  2. util: Use try_lock return value in UniqueLock::TryEnter
    If I understand correctly, the return value if `try_lock` already
    signifies whether the locking was succesful, there is no need to
    call `Base::owns_lock` to check.
    
    Should get rid of the following MSVC warning in AppVeyor:
    "warning C4834: discarding return value of function with 'nodiscard' attribute"
    d30ccb9dd7
  3. laanwj added the label Utils/log/libs on Dec 10, 2019
  4. laanwj commented at 3:45 AM on December 10, 2019: member

    OK this still doesn't fix the AppVeyor build

    C:\projects\bitcoin\src\compat\glibcxx_sanity.cpp(50,13): error C2220: the following warning is treated as an error [C:\projects\bitcoin\build_msvc\libbitcoin_util\libbitcoin_util.vcxproj]
    C:\projects\bitcoin\src\compat\glibcxx_sanity.cpp(50,13): warning C4834: discarding return value of function with 'nodiscard' attribute [C:\projects\bitcoin\build_msvc\libbitcoin_util\libbitcoin_util.vcxproj]
    C:\projects\bitcoin\src\httpserver.cpp(27,10): fatal error C1083: Cannot open include file: 'event2/thread.h': No such file or directory [C:\projects\bitcoin\build_msvc\libbitcoin_server\libbitcoin_server.vcxproj]
    C:\projects\bitcoin\src\zmq\zmqconfig.h(15,10): fatal error C1083: Cannot open include file: 'zmq.h': No such file or directory [C:\projects\bitcoin\build_msvc\libbitcoin_zmq\libbitcoin_zmq.vcxproj]
    

    @sipsorcery we shouldn't be compiling glibcxx_sanity.cpp on MSVC! I don't know where the libevent and zmq errors come from.

  5. laanwj force-pushed on Dec 10, 2019
  6. laanwj commented at 10:30 AM on December 10, 2019: member

    Closing in favor of #17709 I guess…

  7. laanwj closed this on Dec 10, 2019

  8. MarcoFalke locked this on Dec 16, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me