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

@@ -109,7 +109,8 @@ public:
bool first = true;
bool footer = false;
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{

View File

@@ -2254,7 +2254,7 @@ public:
else
{
// pussywizard: notify all online GMs
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->second->GetSession()->GetSecurity())

View File

@@ -284,7 +284,7 @@ public:
stmt->setUInt16(0, uint16(atLogin));
CharacterDatabase.Execute(stmt);
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
itr->second->SetAtLoginFlag(atLogin);

View File

@@ -74,7 +74,7 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, uint32 zone)
bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
{
ACORE_GUARD(ACE_Thread_Mutex, sOutdoorPvPMgr->_lock);
std::lock_guard<std::mutex> guard(sOutdoorPvPMgr->_lock);
switch (trigger)
{