yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

web_service: Replace lock_guard with scoped_lock

This commit is contained in:
Merry 2022-04-07 19:32:47 +01:00
parent bbc585881a
commit 3cf6593342
1 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ constexpr std::size_t TIMEOUT_SECONDS = 30;
struct Client::Impl { struct Client::Impl {
Impl(std::string host, std::string username, std::string token) Impl(std::string host, std::string username, std::string token)
: host{std::move(host)}, username{std::move(username)}, token{std::move(token)} { : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {
std::lock_guard lock{jwt_cache.mutex}; std::scoped_lock lock{jwt_cache.mutex};
if (this->username == jwt_cache.username && this->token == jwt_cache.token) { if (this->username == jwt_cache.username && this->token == jwt_cache.token) {
jwt = jwt_cache.jwt; jwt = jwt_cache.jwt;
} }
@ -147,7 +147,7 @@ struct Client::Impl {
if (result.result_code != WebResult::Code::Success) { if (result.result_code != WebResult::Code::Success) {
LOG_ERROR(WebService, "UpdateJWT failed"); LOG_ERROR(WebService, "UpdateJWT failed");
} else { } else {
std::lock_guard lock{jwt_cache.mutex}; std::scoped_lock lock{jwt_cache.mutex};
jwt_cache.username = username; jwt_cache.username = username;
jwt_cache.token = token; jwt_cache.token = token;
jwt_cache.jwt = jwt = result.returned_data; jwt_cache.jwt = jwt = result.returned_data;