From 8190f18408c035e0fe9e5ea26106fc09bd2224b6 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Mon, 19 Jul 2021 22:07:00 -0700 Subject: [PATCH] :bulb::sparkles: comments & PruneUsers() --- include/bank.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/bank.h b/include/bank.h index 578b64a..e72cd8c 100644 --- a/include/bank.h +++ b/include/bank.h @@ -34,7 +34,9 @@ private: #endif #endif - std::shared_mutex save_lock; + //must grab as shared if the operation is gonna modify "users"'s size or can be caught in a intermediary state such as SendFunds() + //must grab as unique if the operation is gonna user iterators + std::shared_mutex iter_lock; public: std::string admin_account; @@ -54,7 +56,7 @@ public: BankResponse SetBal(const std::string &name, uint32_t amount) noexcept; BankResponse ImpactBal(const std::string &name, int64_t amount) noexcept; bool Contains(const std::string &name) const noexcept; - bool AdminVerifyAccount(const std::string &name) noexcept; + BankResponse PruneUsers(time_t threshold_time, uint32_t threshold_bal) noexcept; BankResponse AddUser(const std::string &name, uint32_t init_bal, const std::string &init_pass) noexcept; BankResponse DelUser(const std::string &name) noexcept;