diff options
author | megamage <none@none> | 2009-08-08 12:37:33 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-08 12:37:33 -0500 |
commit | 1165b889a048a5c448305848f668232c9f683969 (patch) | |
tree | f77d7b58f091181b8c0f50359cd1338e6b7eef1d /src/trinitycore/Master.cpp | |
parent | a3ee65bee10ab7698c750be4d60dac8daa972aa7 (diff) |
[8328] Fixed problem with crash at startup in result destroy anti-freeze thread runnable. Author: VladimirMangos
* Destroy runnable only if no references.
* Some code cleanups
--HG--
branch : trunk
Diffstat (limited to 'src/trinitycore/Master.cpp')
-rw-r--r-- | src/trinitycore/Master.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index b9bf375628b..76fdbd661de 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -238,8 +238,8 @@ int Master::Run() _HookSignals(); ///- Launch WorldRunnable thread - ACE_Based::Thread t(new WorldRunnable); - t.setPriority(ACE_Based::Highest); + ACE_Based::Thread world_thread(new WorldRunnable); + world_thread.setPriority(ACE_Based::Highest); // set server online loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID); @@ -256,7 +256,7 @@ int Master::Run() cliThread = new ACE_Based::Thread(new CliRunnable); } - ACE_Based::Thread td2(new RARunnable); + ACE_Based::Thread rar_thread(new RARunnable); ///- Handle affinity for multiple processors and process priority on Windows #ifdef WIN32 @@ -312,13 +312,12 @@ int Master::Run() uint32 loopCounter = 0; ///- Start up freeze catcher thread - uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0); - if(freeze_delay) + if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) { FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable(); fdr->SetDelayTime(freeze_delay*1000); - ACE_Based::Thread t(fdr); - t.setPriority(ACE_Based::Highest); + ACE_Based::Thread freeze_thread(fdr); + freeze_thread.setPriority(ACE_Based::Highest); } ///- Launch the world listener socket @@ -342,8 +341,8 @@ int Master::Run() // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master - t.wait(); - td2.wait (); + world_thread.wait(); + rar_thread.wait (); ///- Clean database before leaving clearOnlineAccounts(); @@ -355,7 +354,7 @@ int Master::Run() sLog.outString( "Halting process..." ); - if(cliThread) + if (cliThread) { #ifdef WIN32 |