mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🐎🚚 moved shared lock to decrease scope accurately
This commit is contained in:
parent
0954a76b6a
commit
a65224d39e
1 changed files with 1 additions and 1 deletions
|
|
@ -245,7 +245,6 @@ BankResponse Bank::AddUser(const std::string &name, uint32_t init_bal, std::stri
|
|||
}
|
||||
BankResponse Bank::DelUser(const std::string &name) noexcept
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock{save_lock};
|
||||
#if RETURN_ON_DEL
|
||||
uint32_t bal;
|
||||
if (users.if_contains(name, [&bal](const User &u) { bal = u.balance; }) && bal)
|
||||
|
|
@ -256,6 +255,7 @@ BankResponse Bank::DelUser(const std::string &name) noexcept
|
|||
}
|
||||
}
|
||||
#endif
|
||||
std::shared_lock<std::shared_mutex> lock{save_lock};
|
||||
if (users.erase(name))
|
||||
{
|
||||
#if CONSERVATIVE_DISK_SAVE
|
||||
|
|
|
|||
Loading…
Reference in a new issue