aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/World/World.cpp8
-rwxr-xr-xsrc/server/game/World/World.h5
2 files changed, 7 insertions, 6 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 99a04ddfd7e..cb365eefbd6 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -78,7 +78,7 @@
#include "Warden.h"
#include "CalendarMgr.h"
-volatile bool World::m_stopEvent = false;
+ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
volatile uint32 World::m_worldLoopCounter = 0;
@@ -2470,7 +2470,7 @@ void World::_UpdateGameTime()
m_gameTime = thisTime;
///- if there is a shutdown timer
- if (!m_stopEvent && m_ShutdownTimer > 0 && elapsed > 0)
+ if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
{
///- ... and it is overdue, stop the world (set m_stopEvent)
if (m_ShutdownTimer <= elapsed)
@@ -2494,7 +2494,7 @@ void World::_UpdateGameTime()
void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
{
// ignore if server shutdown at next tick
- if (m_stopEvent)
+ if (IsStopped())
return;
m_ShutdownMask = options;
@@ -2546,7 +2546,7 @@ void World::ShutdownMsg(bool show, Player* player)
void World::ShutdownCancel()
{
// nothing cancel or too later
- if (!m_ShutdownTimer || m_stopEvent)
+ if (!m_ShutdownTimer || m_stopEvent.value())
return;
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index cab9c19da8b..1247504678a 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -26,6 +26,7 @@
#include "Common.h"
#include "Timer.h"
#include <ace/Singleton.h>
+#include <ace/Atomic_Op.h>
#include "SharedDefines.h"
#include "QueryResult.h"
#include "Callback.h"
@@ -650,7 +651,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; }
+ static bool IsStopped() { return m_stopEvent.value(); }
void Update(uint32 diff);
@@ -770,7 +771,7 @@ class World
void ResetWeeklyQuests();
void ResetRandomBG();
private:
- static volatile bool m_stopEvent;
+ static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent;
static uint8 m_ExitCode;
uint32 m_ShutdownTimer;
uint32 m_ShutdownMask;