Rewritten Threading system using c++11 std instead of ACE

It also allow full compilation with clang under all supported platforms

Need tests
This commit is contained in:
Yehonal
2016-08-16 00:01:37 +02:00
parent 3761e9d843
commit ea286f7332
14 changed files with 104 additions and 249 deletions

View File

@@ -12,7 +12,7 @@
#define __CLIRUNNABLE_H
/// Command Line Interface handling thread
class CliRunnable : public ACE_Based::Runnable
class CliRunnable : public ACORE::Runnable
{
public:
void run();

View File

@@ -71,7 +71,7 @@ class WorldServerSignalHandler : public Trinity::SignalHandler
}
};
class FreezeDetectorRunnable : public ACE_Based::Runnable
class FreezeDetectorRunnable : public ACORE::Runnable
{
private:
uint32 _loops;
@@ -101,7 +101,7 @@ public:
ASSERT(false);
}
ACE_Based::Thread::Sleep(1000);
ACORE::Thread::Sleep(1000);
}
sLog->outString("Anti-freeze thread exiting without problems.");
}
@@ -171,10 +171,10 @@ int Master::Run()
//handle.register_handler(SIGSEGV, &signalSEGV);
///- Launch WorldRunnable thread
ACE_Based::Thread worldThread(new WorldRunnable);
worldThread.setPriority(ACE_Based::Highest);
ACORE::Thread worldThread(new WorldRunnable);
worldThread.setPriority(ACORE::Priority_Highest);
ACE_Based::Thread* cliThread = NULL;
ACORE::Thread* cliThread = NULL;
#ifdef _WIN32
if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
@@ -183,14 +183,14 @@ int Master::Run()
#endif
{
///- Launch CliRunnable thread
cliThread = new ACE_Based::Thread(new CliRunnable);
cliThread = new ACORE::Thread(new CliRunnable);
}
ACE_Based::Thread rarThread(new RARunnable);
ACORE::Thread rarThread(new RARunnable);
// pussywizard:
ACE_Based::Thread auctionLising_thread(new AuctionListingRunnable);
auctionLising_thread.setPriority(ACE_Based::High);
ACORE::Thread auctionLising_thread(new AuctionListingRunnable);
auctionLising_thread.setPriority(ACORE::Priority_High);
#if defined(_WIN32) || defined(__linux__)
@@ -262,21 +262,21 @@ int Master::Run()
#endif
// Start soap serving thread
ACE_Based::Thread* soapThread = NULL;
ACORE::Thread* soapThread = NULL;
if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable* runnable = new TCSoapRunnable();
runnable->SetListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878)));
soapThread = new ACE_Based::Thread(runnable);
soapThread = new ACORE::Thread(runnable);
}
// Start up freeze catcher thread
ACE_Based::Thread* freezeThread = NULL;
ACORE::Thread* freezeThread = NULL;
if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable* runnable = new FreezeDetectorRunnable(freezeDelay*1000);
freezeThread = new ACE_Based::Thread(runnable);
freezeThread->setPriority(ACE_Based::Highest);
freezeThread = new ACORE::Thread(runnable);
freezeThread->setPriority(ACORE::Priority_Highest);
}
///- Launch the world listener socket

View File

@@ -16,7 +16,7 @@
#include <ace/Reactor.h>
class RARunnable : public ACE_Based::Runnable
class RARunnable : public ACORE::Runnable
{
public:
RARunnable();

View File

@@ -15,7 +15,7 @@
#include <ace/Task.h>
#include <Threading.h>
class TCSoapRunnable : public ACE_Based::Runnable
class TCSoapRunnable : public ACORE::Runnable
{
public:
TCSoapRunnable() : _port(0) { }

View File

@@ -51,7 +51,7 @@ void WorldRunnable::run()
avgDiffTracker.Update(executionTimeDiff > WORLD_SLEEP_CONST ? executionTimeDiff : WORLD_SLEEP_CONST);
if (executionTimeDiff < WORLD_SLEEP_CONST)
ACE_Based::Thread::Sleep(WORLD_SLEEP_CONST-executionTimeDiff);
ACORE::Thread::Sleep(WORLD_SLEEP_CONST-executionTimeDiff);
#ifdef _WIN32
if (m_ServiceStatus == 0)
@@ -118,7 +118,7 @@ void AuctionListingRunnable::run()
}
}
}
ACE_Based::Thread::Sleep(1);
ACORE::Thread::Sleep(1);
}
sLog->outString("Auction House Listing thread exiting without problems.");
}

View File

@@ -12,13 +12,13 @@
#define __WORLDRUNNABLE_H
/// Heartbeat thread for the World
class WorldRunnable : public ACE_Based::Runnable
class WorldRunnable : public ACORE::Runnable
{
public:
void run();
};
class AuctionListingRunnable : public ACE_Based::Runnable
class AuctionListingRunnable : public ACORE::Runnable
{
public:
void run();