Rename CriticalSection wrapper functions to match std::mutex usage

EnterCallbackIdCriticalSection/LeaveCallbackIdCriticalSection -> lockCallbackScenes/unlockCallbackScenes, EnterSaveNotificationSection/LeaveSaveNotificationSection -> lockSaveNotification/unlockSaveNotification, m_saveNotificationCriticalSection -> m_saveNotificationMutex.
This commit is contained in:
MatthewBeshay 2026-03-31 00:16:16 +11:00
parent e4520df31f
commit a513fa7597
7 changed files with 18 additions and 18 deletions

View file

@ -1176,7 +1176,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
switch (eAction) { switch (eAction) {
case eXuiServerAction_AutoSaveGame: case eXuiServerAction_AutoSaveGame:
case eXuiServerAction_SaveGame: case eXuiServerAction_SaveGame:
app.EnterSaveNotificationSection(); app.lockSaveNotification();
if (players != nullptr) { if (players != nullptr) {
players->saveAll( players->saveAll(
Minecraft::GetInstance()->progressRenderer); Minecraft::GetInstance()->progressRenderer);
@ -1211,7 +1211,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
Minecraft::GetInstance()->progressRenderer, Minecraft::GetInstance()->progressRenderer,
(eAction == eXuiServerAction_AutoSaveGame)); (eAction == eXuiServerAction_AutoSaveGame));
} }
app.LeaveSaveNotificationSection(); app.unlockSaveNotification();
break; break;
case eXuiServerAction_DropItem: case eXuiServerAction_DropItem:
// Find the player, and drop the id at their feet // Find the player, and drop the id at their feet
@ -1292,7 +1292,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
break; break;
case eXuiServerAction_ExportSchematic: case eXuiServerAction_ExportSchematic:
#if !defined(_CONTENT_PACKAGE) #if !defined(_CONTENT_PACKAGE)
app.EnterSaveNotificationSection(); app.lockSaveNotification();
// players->broadcastAll( // players->broadcastAll(
// shared_ptr<UpdateProgressPacket>( new // shared_ptr<UpdateProgressPacket>( new
@ -1326,7 +1326,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
delete initData; delete initData;
} }
app.LeaveSaveNotificationSection(); app.unlockSaveNotification();
#endif #endif
break; break;
case eXuiServerAction_SetCameraLocation: case eXuiServerAction_SetCameraLocation:

View file

@ -5641,8 +5641,8 @@ DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) {
return nullptr; return nullptr;
} }
void CMinecraftApp::EnterSaveNotificationSection() { void CMinecraftApp::lockSaveNotification() {
std::lock_guard<std::mutex> lock(m_saveNotificationCriticalSection); std::lock_guard<std::mutex> lock(m_saveNotificationMutex);
if (m_saveNotificationDepth++ == 0) { if (m_saveNotificationDepth++ == 0) {
if (g_NetworkManager if (g_NetworkManager
.IsInSession()) // this can be triggered from the front end if .IsInSession()) // this can be triggered from the front end if
@ -5660,8 +5660,8 @@ void CMinecraftApp::EnterSaveNotificationSection() {
} }
} }
void CMinecraftApp::LeaveSaveNotificationSection() { void CMinecraftApp::unlockSaveNotification() {
std::lock_guard<std::mutex> lock(m_saveNotificationCriticalSection); std::lock_guard<std::mutex> lock(m_saveNotificationMutex);
if (--m_saveNotificationDepth == 0) { if (--m_saveNotificationDepth == 0) {
if (g_NetworkManager if (g_NetworkManager
.IsInSession()) // this can be triggered from the front end if .IsInSession()) // this can be triggered from the front end if

View file

@ -880,11 +880,11 @@ public:
void SetCorruptSaveDeleted(bool bVal) { m_bCorruptSaveDeleted = bVal; } void SetCorruptSaveDeleted(bool bVal) { m_bCorruptSaveDeleted = bVal; }
bool GetCorruptSaveDeleted(void) { return m_bCorruptSaveDeleted; } bool GetCorruptSaveDeleted(void) { return m_bCorruptSaveDeleted; }
void EnterSaveNotificationSection(); void lockSaveNotification();
void LeaveSaveNotificationSection(); void unlockSaveNotification();
private: private:
std::mutex m_saveNotificationCriticalSection; std::mutex m_saveNotificationMutex;
int m_saveNotificationDepth; int m_saveNotificationDepth;
// Download Status // Download Status

View file

@ -1400,11 +1400,11 @@ UIScene* UIController::GetSceneFromCallbackId(size_t id) {
return scene; return scene;
} }
void UIController::EnterCallbackIdCriticalSection() { void UIController::lockCallbackScenes() {
m_registeredCallbackScenesCS.lock(); m_registeredCallbackScenesCS.lock();
} }
void UIController::LeaveCallbackIdCriticalSection() { void UIController::unlockCallbackScenes() {
m_registeredCallbackScenesCS.unlock(); m_registeredCallbackScenesCS.unlock();
} }

View file

@ -312,8 +312,8 @@ public:
size_t RegisterForCallbackId(UIScene* scene); size_t RegisterForCallbackId(UIScene* scene);
void UnregisterCallbackId(size_t id); void UnregisterCallbackId(size_t id);
UIScene* GetSceneFromCallbackId(size_t id); UIScene* GetSceneFromCallbackId(size_t id);
void EnterCallbackIdCriticalSection(); void lockCallbackScenes();
void LeaveCallbackIdCriticalSection(); void unlockCallbackScenes();
private: private:
void setFullscreenMenuDisplayed(bool displayed); void setFullscreenMenuDisplayed(bool displayed);

View file

@ -95,7 +95,7 @@ UIScene_InGameSaveManagementMenu::~UIScene_InGameSaveManagementMenu() {
} }
delete[] m_saveDetails; delete[] m_saveDetails;
} }
app.LeaveSaveNotificationSection(); app.unlockSaveNotification();
StorageManager.SetSaveDisabled(false); StorageManager.SetSaveDisabled(false);
StorageManager.ContinueIncompleteOperation(); StorageManager.ContinueIncompleteOperation();
} }

View file

@ -1442,7 +1442,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(
} }
int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) { int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) {
ui.EnterCallbackIdCriticalSection(); ui.lockCallbackScenes();
UIScene_LoadOrJoinMenu* pClass = UIScene_LoadOrJoinMenu* pClass =
(UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam);
@ -1455,7 +1455,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) {
pClass->updateTooltips(); pClass->updateTooltips();
} }
ui.LeaveCallbackIdCriticalSection(); ui.unlockCallbackScenes();
return 0; return 0;
} }