general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities means that we no longer need to hardcode the mutex type into the locks themselves, making it easier to switch mutex types, should it ever be necessary in the future.
This commit is contained in:
parent
d9b7bc4474
commit
781ab8407b
23 changed files with 77 additions and 75 deletions
|
@ -24,7 +24,7 @@ constexpr u32 TIMEOUT_SECONDS = 30;
|
|||
struct Client::Impl {
|
||||
Impl(std::string host, std::string username, std::string token)
|
||||
: host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {
|
||||
std::lock_guard<std::mutex> lock(jwt_cache.mutex);
|
||||
std::lock_guard lock{jwt_cache.mutex};
|
||||
if (this->username == jwt_cache.username && this->token == jwt_cache.token) {
|
||||
jwt = jwt_cache.jwt;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ struct Client::Impl {
|
|||
if (result.result_code != Common::WebResult::Code::Success) {
|
||||
LOG_ERROR(WebService, "UpdateJWT failed");
|
||||
} else {
|
||||
std::lock_guard<std::mutex> lock(jwt_cache.mutex);
|
||||
std::lock_guard lock{jwt_cache.mutex};
|
||||
jwt_cache.username = username;
|
||||
jwt_cache.token = token;
|
||||
jwt_cache.jwt = jwt = result.returned_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue