ACE cleanup on game, now the major issue remains WorldSocket

This commit is contained in:
leak
2014-07-02 02:20:53 +02:00
parent 66c94ce965
commit e0aed65c8c
11 changed files with 25 additions and 22 deletions

View File

@@ -50,7 +50,7 @@ message(STATUS "MSVC: Disabled POSIX warnings")
if(NOT WITH_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4800")
message(STATUS "MSVC: Disabled generic compiletime warnings")
endif()

View File

@@ -191,7 +191,6 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
//add GroupInfo to m_QueuedGroups
{
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
m_QueuedGroups[bracketId][index].push_back(ginfo);
//announce to world, this code needs mutex

View File

@@ -20,8 +20,6 @@
#define TRINITY_MAP_H
#include "Define.h"
#include <ace/RW_Thread_Mutex.h>
#include <ace/Thread_Mutex.h>
#include "DBCStructure.h"
#include "GridDefines.h"

View File

@@ -175,8 +175,10 @@ struct TSpellSummary
uint8 Effects; // set of enum SelectEffect
} *SpellSummary;
ScriptMgr::ScriptMgr()
: _scriptCount(0), _scheduledScripts(0) { }
ScriptMgr::ScriptMgr() : _scriptCount(0)
{
_scheduledScripts = 0;
}
ScriptMgr::~ScriptMgr() { }

View File

@@ -19,9 +19,8 @@
#ifndef SC_SCRIPTMGR_H
#define SC_SCRIPTMGR_H
#include <atomic>
#include "Common.h"
#include <ace/Atomic_Op.h>
#include "DBCStores.h"
#include "QuestDef.h"
#include "SharedDefines.h"
@@ -1128,7 +1127,7 @@ class ScriptMgr
uint32 _scriptCount;
//atomic op counter for active scripts amount
ACE_Atomic_Op<ACE_Thread_Mutex, long> _scheduledScripts;
std::atomic_long _scheduledScripts;
};
#endif

View File

@@ -372,10 +372,11 @@ class WorldSession
void SetLatency(uint32 latency) { m_latency = latency; }
void ResetClientTimeDelay() { m_clientTimeDelay = 0; }
ACE_Atomic_Op<ACE_Thread_Mutex, time_t> m_timeOutTime;
std::atomic<time_t> m_timeOutTime;
void UpdateTimeOutTime(uint32 diff)
{
if (time_t(diff) > m_timeOutTime.value())
if (time_t(diff) > m_timeOutTime)
m_timeOutTime = 0;
else
m_timeOutTime -= diff;

View File

@@ -164,7 +164,7 @@ void WardenCheckMgr::LoadWardenOverrides()
uint32 count = 0;
ACE_WRITE_GUARD(ACE_RW_Mutex, g, _checkStoreLock);
boost::unique_lock<boost::shared_mutex> lock(sWardenCheckMgr->_checkStoreLock);
do
{

View File

@@ -20,6 +20,8 @@
#define _WARDENCHECKMGR_H
#include <map>
#include <boost/thread/locks.hpp>
#include <boost/thread/shared_mutex.hpp>
#include "Cryptography/BigNumber.h"
enum WardenActions
@@ -72,7 +74,7 @@ class WardenCheckMgr
void LoadWardenChecks();
void LoadWardenOverrides();
ACE_RW_Mutex _checkStoreLock;
boost::shared_mutex _checkStoreLock;
private:
CheckContainer CheckStore;

View File

@@ -206,7 +206,7 @@ void WardenWin::RequestData()
ByteBuffer buff;
buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST);
ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock);
boost::shared_lock<boost::shared_mutex> lock(sWardenCheckMgr->_checkStoreLock);
for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_OTHER_CHECKS); ++i)
{
@@ -369,7 +369,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
uint8 type;
uint16 checkFailed = 0;
ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock);
boost::shared_lock<boost::shared_mutex> lock(sWardenCheckMgr->_checkStoreLock);
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
{

View File

@@ -20,6 +20,7 @@
\ingroup world
*/
#include <atomic>
#include "Common.h"
#include "Memory.h"
#include "DatabaseEnv.h"
@@ -81,9 +82,10 @@
#include "BattlefieldMgr.h"
#include "TransportMgr.h"
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
std::atomic<bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
ACE_Atomic_Op<ACE_Thread_Mutex, uint32> World::m_worldLoopCounter = 0;
std::atomic_uint32_t World::m_worldLoopCounter = 0;
float World::m_MaxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE;
float World::m_MaxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE;
@@ -2590,7 +2592,7 @@ void World::ShutdownMsg(bool show, Player* player)
void World::ShutdownCancel()
{
// nothing cancel or too later
if (!m_ShutdownTimer || m_stopEvent.value())
if (!m_ShutdownTimer || m_stopEvent)
return;
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;

View File

@@ -25,11 +25,11 @@
#include "Common.h"
#include "Timer.h"
#include <ace/Atomic_Op.h>
#include "SharedDefines.h"
#include "QueryResult.h"
#include "Callback.h"
#include <atomic>
#include <map>
#include <set>
#include <list>
@@ -523,7 +523,7 @@ class World
return instance;
}
static ACE_Atomic_Op<ACE_Thread_Mutex, uint32> m_worldLoopCounter;
static std::atomic_uint32_t m_worldLoopCounter;
WorldSession* FindSession(uint32 id) const;
void AddSession(WorldSession* s);
@@ -636,7 +636,7 @@ class World
void ShutdownMsg(bool show = false, Player* player = NULL);
static uint8 GetExitCode() { return m_ExitCode; }
static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; }
static bool IsStopped() { return m_stopEvent.value(); }
static bool IsStopped() { return m_stopEvent; }
void Update(uint32 diff);
@@ -761,7 +761,7 @@ class World
World();
~World();
static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent;
static std::atomic<bool> m_stopEvent;
static uint8 m_ExitCode;
uint32 m_ShutdownTimer;
uint32 m_ShutdownMask;