ams: deduplicate static initialization logic
This commit is contained in:
1 parent
78f7218c4f
commit
30fac905af
24 files changed
+202
-262
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user