mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
refactor(Core): replace ACE atomic types with standard C++ (#3421)
* Update AuctionHouseHandler.cpp * refactor(atomic-type): replace ACE atomic types Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Co-authored-by: Kargatum <dowlandtop@yandex.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <ace/os_include/sys/os_types.h>
|
||||
#include <ace/os_include/sys/os_socket.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <set>
|
||||
|
||||
#include "Log.h"
|
||||
@@ -92,7 +93,7 @@ class ReactorRunnable : protected ACE_Task_Base
|
||||
|
||||
long Connections()
|
||||
{
|
||||
return static_cast<long> (m_Connections);
|
||||
return m_Connections;
|
||||
}
|
||||
|
||||
int AddSocket (WorldSocket* sock)
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
|
||||
std::atomic_long World::m_stopEvent = false;
|
||||
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
||||
uint32 World::m_worldLoopCounter = 0;
|
||||
uint32 World::m_gameMSTime = 0;
|
||||
@@ -2616,7 +2616,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;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Timer.h"
|
||||
#include <ace/Atomic_Op.h>
|
||||
#include "SharedDefines.h"
|
||||
#include "QueryResult.h"
|
||||
#include "Callback.h"
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <atomic>
|
||||
|
||||
class Object;
|
||||
class WorldPacket;
|
||||
@@ -395,7 +395,7 @@ enum Rates
|
||||
RATE_DROP_ITEM_LEGENDARY,
|
||||
RATE_DROP_ITEM_ARTIFACT,
|
||||
RATE_DROP_ITEM_REFERENCED,
|
||||
|
||||
|
||||
RATE_DROP_ITEM_REFERENCED_AMOUNT,
|
||||
RATE_SELLVALUE_ITEM_POOR,
|
||||
RATE_SELLVALUE_ITEM_NORMAL,
|
||||
@@ -723,7 +723,7 @@ class World
|
||||
void ShutdownMsg(bool show = false, Player* player = nullptr);
|
||||
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);
|
||||
|
||||
@@ -856,7 +856,7 @@ class World
|
||||
void CalendarDeleteOldEvents();
|
||||
void ResetGuildCap();
|
||||
private:
|
||||
static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent;
|
||||
static std::atomic_long m_stopEvent;
|
||||
static uint8 m_ExitCode;
|
||||
uint32 m_ShutdownTimer;
|
||||
uint32 m_ShutdownMask;
|
||||
|
||||
@@ -48,7 +48,7 @@ int RASocket::handle_close(ACE_HANDLE /*handle*/, ACE_Reactor_Mask /*mask*/)
|
||||
// While the above wait() will wait for the ::svc() to finish, it will not wait for the async event
|
||||
// RASocket::commandfinished to be completed. Calling destroy() before the latter function ends
|
||||
// will lead to using a freed pointer -> crash.
|
||||
while (_commandExecuting.value())
|
||||
while (_commandExecuting)
|
||||
ACE_OS::sleep(1);
|
||||
|
||||
destroy();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <ace/Svc_Handler.h>
|
||||
#include <ace/SOCK_Stream.h>
|
||||
#include <ace/SOCK_Acceptor.h>
|
||||
#include <atomic>
|
||||
|
||||
/// Remote Administration socket
|
||||
class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
||||
@@ -44,7 +45,7 @@ class RASocket : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
|
||||
|
||||
private:
|
||||
uint8 _minLevel; ///< Minimum security level required to connect
|
||||
ACE_Atomic_Op<ACE_Thread_Mutex, bool> _commandExecuting;
|
||||
std::atomic_long _commandExecuting;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user