mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-29 14:05:17 -04:00
ams: deduplicate static initialization logic
This commit is contained in:
parent
78f7218c4f
commit
30fac905af
24 changed files with 202 additions and 262 deletions
|
@ -73,18 +73,7 @@ namespace ams::erpt::srv {
|
|||
}
|
||||
|
||||
bool IsProductionMode() {
|
||||
static constinit bool s_initialized = false;
|
||||
static constinit bool s_is_prod_mode = true;
|
||||
static constinit os::SdkMutex s_mutex;
|
||||
|
||||
if (AMS_UNLIKELY(!s_initialized)) {
|
||||
std::scoped_lock lk(s_mutex);
|
||||
|
||||
if (AMS_LIKELY(!s_initialized)) {
|
||||
s_is_prod_mode = IsProductionModeImpl();
|
||||
s_initialized = true;
|
||||
}
|
||||
}
|
||||
AMS_FUNCTION_LOCAL_STATIC(bool, s_is_prod_mode, IsProductionModeImpl());
|
||||
|
||||
return s_is_prod_mode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue