Skip to content

Commit b6366f9

Browse files
killerwifeajbathe
andcommitted
Fix: use std::atomic for m_worldLoopCounter
Closes cmangos#614 Co-Authored-By: Andreas J. Bathe <ajbathe@users.noreply.github.com>
1 parent b2ae050 commit b6366f9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/game/World/World.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ extern void LoadGameObjectModelList();
9595

9696
volatile bool World::m_stopEvent = false;
9797
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
98-
volatile uint32 World::m_worldLoopCounter = 0;
98+
std::atomic<uint32> World::m_worldLoopCounter = 0;
9999

100100
float World::m_MaxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE;
101101
float World::m_MaxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE;

src/game/World/World.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <utility>
4242
#include <vector>
4343
#include <array>
44+
#include <atomic>
4445

4546
class Object;
4647
class ObjectGuid;
@@ -392,7 +393,7 @@ struct CliCommandHolder
392393
class World
393394
{
394395
public:
395-
static volatile uint32 m_worldLoopCounter;
396+
static std::atomic<uint32> m_worldLoopCounter;
396397

397398
World();
398399
~World();

0 commit comments

Comments
 (0)