mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🐎:fire thread_local is not required as its only ever called by one thread
This commit is contained in:
parent
0f128e04a0
commit
e0b38be7e6
1 changed files with 4 additions and 3 deletions
|
|
@ -276,6 +276,7 @@ void Bank::DelSelf(const std::string &name) noexcept
|
||||||
std::shared_lock<std::shared_mutex> lock{save_lock};
|
std::shared_lock<std::shared_mutex> lock{save_lock};
|
||||||
users.erase(name);
|
users.erase(name);
|
||||||
}
|
}
|
||||||
|
//ONLY EVER BEING CALLED BY SAVE THREAD OR C-INTERUPT
|
||||||
const char *Bank::Save()
|
const char *Bank::Save()
|
||||||
{
|
{
|
||||||
#if CONSERVATIVE_DISK_SAVE
|
#if CONSERVATIVE_DISK_SAVE
|
||||||
|
|
@ -288,12 +289,12 @@ const char *Bank::Save()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
static thread_local std::ofstream users_save(users_location, std::ios::out | std::ios::binary);
|
static std::ofstream users_save(users_location, std::ios::out | std::ios::binary);
|
||||||
if (!users_save.is_open())
|
if (!users_save.is_open())
|
||||||
{
|
{
|
||||||
throw std::invalid_argument("Cannot access saving file\n");
|
throw std::invalid_argument("Cannot access saving file\n");
|
||||||
}
|
}
|
||||||
static thread_local bank_dom::Global users_copy;
|
static bank_dom::Global users_copy;
|
||||||
users_copy.users.clear();
|
users_copy.users.clear();
|
||||||
users_copy.keys.clear();
|
users_copy.keys.clear();
|
||||||
users_copy.users.reserve(users.size());
|
users_copy.users.reserve(users.size());
|
||||||
|
|
@ -309,7 +310,7 @@ const char *Bank::Save()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static thread_local FBE::bank_dom::GlobalFinalModel writer;
|
static FBE::bank_dom::GlobalFinalModel writer;
|
||||||
writer.serialize(users_copy);
|
writer.serialize(users_copy);
|
||||||
if (!writer.verify())
|
if (!writer.verify())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue