mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 04:13:37 +00:00
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:
parent
e4520df31f
commit
a513fa7597
|
|
@ -1176,7 +1176,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
|||
switch (eAction) {
|
||||
case eXuiServerAction_AutoSaveGame:
|
||||
case eXuiServerAction_SaveGame:
|
||||
app.EnterSaveNotificationSection();
|
||||
app.lockSaveNotification();
|
||||
if (players != nullptr) {
|
||||
players->saveAll(
|
||||
Minecraft::GetInstance()->progressRenderer);
|
||||
|
|
@ -1211,7 +1211,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
|||
Minecraft::GetInstance()->progressRenderer,
|
||||
(eAction == eXuiServerAction_AutoSaveGame));
|
||||
}
|
||||
app.LeaveSaveNotificationSection();
|
||||
app.unlockSaveNotification();
|
||||
break;
|
||||
case eXuiServerAction_DropItem:
|
||||
// Find the player, and drop the id at their feet
|
||||
|
|
@ -1292,7 +1292,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
|||
break;
|
||||
case eXuiServerAction_ExportSchematic:
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
app.EnterSaveNotificationSection();
|
||||
app.lockSaveNotification();
|
||||
|
||||
// players->broadcastAll(
|
||||
// shared_ptr<UpdateProgressPacket>( new
|
||||
|
|
@ -1326,7 +1326,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
|||
|
||||
delete initData;
|
||||
}
|
||||
app.LeaveSaveNotificationSection();
|
||||
app.unlockSaveNotification();
|
||||
#endif
|
||||
break;
|
||||
case eXuiServerAction_SetCameraLocation:
|
||||
|
|
|
|||
|
|
@ -5641,8 +5641,8 @@ DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void CMinecraftApp::EnterSaveNotificationSection() {
|
||||
std::lock_guard<std::mutex> lock(m_saveNotificationCriticalSection);
|
||||
void CMinecraftApp::lockSaveNotification() {
|
||||
std::lock_guard<std::mutex> lock(m_saveNotificationMutex);
|
||||
if (m_saveNotificationDepth++ == 0) {
|
||||
if (g_NetworkManager
|
||||
.IsInSession()) // this can be triggered from the front end if
|
||||
|
|
@ -5660,8 +5660,8 @@ void CMinecraftApp::EnterSaveNotificationSection() {
|
|||
}
|
||||
}
|
||||
|
||||
void CMinecraftApp::LeaveSaveNotificationSection() {
|
||||
std::lock_guard<std::mutex> lock(m_saveNotificationCriticalSection);
|
||||
void CMinecraftApp::unlockSaveNotification() {
|
||||
std::lock_guard<std::mutex> lock(m_saveNotificationMutex);
|
||||
if (--m_saveNotificationDepth == 0) {
|
||||
if (g_NetworkManager
|
||||
.IsInSession()) // this can be triggered from the front end if
|
||||
|
|
|
|||
|
|
@ -880,11 +880,11 @@ public:
|
|||
void SetCorruptSaveDeleted(bool bVal) { m_bCorruptSaveDeleted = bVal; }
|
||||
bool GetCorruptSaveDeleted(void) { return m_bCorruptSaveDeleted; }
|
||||
|
||||
void EnterSaveNotificationSection();
|
||||
void LeaveSaveNotificationSection();
|
||||
void lockSaveNotification();
|
||||
void unlockSaveNotification();
|
||||
|
||||
private:
|
||||
std::mutex m_saveNotificationCriticalSection;
|
||||
std::mutex m_saveNotificationMutex;
|
||||
int m_saveNotificationDepth;
|
||||
// Download Status
|
||||
|
||||
|
|
|
|||
|
|
@ -1400,11 +1400,11 @@ UIScene* UIController::GetSceneFromCallbackId(size_t id) {
|
|||
return scene;
|
||||
}
|
||||
|
||||
void UIController::EnterCallbackIdCriticalSection() {
|
||||
void UIController::lockCallbackScenes() {
|
||||
m_registeredCallbackScenesCS.lock();
|
||||
}
|
||||
|
||||
void UIController::LeaveCallbackIdCriticalSection() {
|
||||
void UIController::unlockCallbackScenes() {
|
||||
m_registeredCallbackScenesCS.unlock();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,8 +312,8 @@ public:
|
|||
size_t RegisterForCallbackId(UIScene* scene);
|
||||
void UnregisterCallbackId(size_t id);
|
||||
UIScene* GetSceneFromCallbackId(size_t id);
|
||||
void EnterCallbackIdCriticalSection();
|
||||
void LeaveCallbackIdCriticalSection();
|
||||
void lockCallbackScenes();
|
||||
void unlockCallbackScenes();
|
||||
|
||||
private:
|
||||
void setFullscreenMenuDisplayed(bool displayed);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ UIScene_InGameSaveManagementMenu::~UIScene_InGameSaveManagementMenu() {
|
|||
}
|
||||
delete[] m_saveDetails;
|
||||
}
|
||||
app.LeaveSaveNotificationSection();
|
||||
app.unlockSaveNotification();
|
||||
StorageManager.SetSaveDisabled(false);
|
||||
StorageManager.ContinueIncompleteOperation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1442,7 +1442,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(
|
|||
}
|
||||
|
||||
int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) {
|
||||
ui.EnterCallbackIdCriticalSection();
|
||||
ui.lockCallbackScenes();
|
||||
UIScene_LoadOrJoinMenu* pClass =
|
||||
(UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam);
|
||||
|
||||
|
|
@ -1455,7 +1455,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) {
|
|||
|
||||
pClass->updateTooltips();
|
||||
}
|
||||
ui.LeaveCallbackIdCriticalSection();
|
||||
ui.unlockCallbackScenes();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue