mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
feat(Core/Threading): replace ace threading (#4821)
This commit is contained in:
@@ -404,7 +404,7 @@ void Map::EnsureGridCreated(const GridCoord& p)
|
||||
{
|
||||
if (getNGrid(p.x_coord, p.y_coord)) // pussywizard
|
||||
return;
|
||||
ACORE_GUARD(ACE_Thread_Mutex, GridLock);
|
||||
std::lock_guard<std::mutex> guard(GridLock);
|
||||
EnsureGridCreated_i(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#include "PathGenerator.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Timer.h"
|
||||
#include <ace/RW_Thread_Mutex.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include <bitset>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
|
||||
class Unit;
|
||||
class WorldPacket;
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
[[nodiscard]] Map const* GetParent() const { return m_parentMap; }
|
||||
|
||||
// pussywizard: movemaps, mmaps
|
||||
[[nodiscard]] ACE_RW_Thread_Mutex& GetMMapLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&MMapLock)); }
|
||||
[[nodiscard]] std::shared_mutex& GetMMapLock() const { return *(const_cast<std::shared_mutex*>(&MMapLock)); }
|
||||
// pussywizard:
|
||||
std::unordered_set<Object*> i_objectsToUpdate;
|
||||
void BuildAndSendUpdateForObjects(); // definition in ObjectAccessor.cpp, below ObjectAccessor::Update, because it does the same for a map
|
||||
@@ -580,9 +580,9 @@ private:
|
||||
void UpdateActiveCells(const float& x, const float& y, const uint32 t_diff);
|
||||
|
||||
protected:
|
||||
ACE_Thread_Mutex Lock;
|
||||
ACE_Thread_Mutex GridLock;
|
||||
ACE_RW_Thread_Mutex MMapLock;
|
||||
std::mutex Lock;
|
||||
std::mutex GridLock;
|
||||
std::shared_mutex MMapLock;
|
||||
|
||||
MapEntry const* i_mapEntry;
|
||||
uint8 i_spawnMode;
|
||||
|
||||
@@ -175,7 +175,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty)
|
||||
{
|
||||
// load/create a map
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
std::lock_guard<std::mutex> guard(Lock);
|
||||
|
||||
// make sure we have a valid map id
|
||||
const MapEntry* entry = sMapStore.LookupEntry(GetId());
|
||||
@@ -218,7 +218,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
|
||||
BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg)
|
||||
{
|
||||
// load/create a map
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
std::lock_guard<std::mutex> guard(Lock);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId());
|
||||
|
||||
@@ -71,7 +71,7 @@ Map* MapManager::CreateBaseMap(uint32 id)
|
||||
|
||||
if (map == nullptr)
|
||||
{
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
std::lock_guard<std::mutex> guard(Lock);
|
||||
|
||||
map = FindBaseMap(id);
|
||||
if (map == nullptr) // pussywizard: check again after acquiring mutex
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Map.h"
|
||||
#include "MapUpdater.h"
|
||||
#include "Object.h"
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include <mutex>
|
||||
|
||||
class Transport;
|
||||
class StaticTransport;
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
MapManager(const MapManager&);
|
||||
MapManager& operator=(const MapManager&);
|
||||
|
||||
ACE_Thread_Mutex Lock;
|
||||
std::mutex Lock;
|
||||
MapMapType i_maps;
|
||||
IntervalTimer i_timer[4]; // continents, bgs/arenas, instances, total from the beginning
|
||||
uint8 mapUpdateStep;
|
||||
|
||||
Reference in New Issue
Block a user