feat(Core/Threading): replace ace threading (#4821)

This commit is contained in:
Kargatum
2021-04-17 00:45:29 +07:00
committed by GitHub
parent b9e84d8278
commit b2861be1cd
50 changed files with 300 additions and 342 deletions

View File

@@ -6508,7 +6508,7 @@ uint32 ObjectMgr::GenerateMailID()
sLog->outError("Mail ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
ACORE_GUARD(ACE_Thread_Mutex, _mailIdMutex);
std::lock_guard<std::mutex> guard(_mailIdMutex);
return _mailId++;
}
@@ -6519,25 +6519,25 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
case HIGHGUID_ITEM:
{
ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiItemGuidMutex);
std::lock_guard<std::mutex> guard(_hiItemGuidMutex);
return _hiItemGuid++;
}
case HIGHGUID_UNIT:
{
ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiCreatureGuidMutex);
std::lock_guard<std::mutex> guard(_hiCreatureGuidMutex);
return _hiCreatureGuid++;
}
case HIGHGUID_PET:
{
ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiPetGuidMutex);
std::lock_guard<std::mutex> guard(_hiPetGuidMutex);
return _hiPetGuid++;
}
case HIGHGUID_VEHICLE:
{
ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiVehicleGuidMutex);
std::lock_guard<std::mutex> guard(_hiVehicleGuidMutex);
return _hiVehicleGuid++;
}
case HIGHGUID_PLAYER:
@@ -6548,25 +6548,25 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
case HIGHGUID_GAMEOBJECT:
{
ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiGoGuidMutex);
std::lock_guard<std::mutex> guard(_hiGoGuidMutex);
return _hiGoGuid++;
}
case HIGHGUID_CORPSE:
{
ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiCorpseGuidMutex);
std::lock_guard<std::mutex> guard(_hiCorpseGuidMutex);
return _hiCorpseGuid++;
}
case HIGHGUID_DYNAMICOBJECT:
{
ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiDoGuidMutex);
std::lock_guard<std::mutex> guard(_hiDoGuidMutex);
return _hiDoGuid++;
}
case HIGHGUID_MO_TRANSPORT:
{
ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!");
ACORE_GUARD(ACE_Thread_Mutex, _hiMoTransGuidMutex);
std::lock_guard<std::mutex> guard(_hiMoTransGuidMutex);
return _hiMoTransGuid++;
}
default:
@@ -7047,7 +7047,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry)
uint32 ObjectMgr::GeneratePetNumber()
{
ACORE_GUARD(ACE_Thread_Mutex, _hiPetNumberMutex);
std::lock_guard<std::mutex> guard(_hiPetNumberMutex);
return ++_hiPetNumber;
}