mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
[8318] Deleted as expected runnable objects at related Thread deleting for avoid memory leaks. Author: VladimirMangos
[8319] Restore compile PGSQL support after last changes. Author: ApoC --HG-- branch : trunk
This commit is contained in:
@@ -238,12 +238,14 @@ int Master::Run()
|
||||
_HookSignals();
|
||||
|
||||
///- Launch WorldRunnable thread
|
||||
ACE_Based::Thread t(*new WorldRunnable);
|
||||
t.setPriority ((ACE_Based::Priority )2);
|
||||
ACE_Based::Thread t(new WorldRunnable);
|
||||
t.setPriority(ACE_Based::Highest);
|
||||
|
||||
// set server online
|
||||
loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID);
|
||||
|
||||
ACE_Based::Thread* cliThread = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
|
||||
#else
|
||||
@@ -251,10 +253,10 @@ int Master::Run()
|
||||
#endif
|
||||
{
|
||||
///- Launch CliRunnable thread
|
||||
ACE_Based::Thread td1(*new CliRunnable);
|
||||
cliThread = new ACE_Based::Thread(new CliRunnable);
|
||||
}
|
||||
|
||||
ACE_Based::Thread td2(*new RARunnable);
|
||||
ACE_Based::Thread td2(new RARunnable);
|
||||
|
||||
///- Handle affinity for multiple processors and process priority on Windows
|
||||
#ifdef WIN32
|
||||
@@ -315,8 +317,13 @@ int Master::Run()
|
||||
{
|
||||
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
|
||||
fdr->SetDelayTime(freeze_delay*1000);
|
||||
<<<<<<< HEAD:src/mangosd/Master.cpp
|
||||
ACE_Based::Thread t(*fdr);
|
||||
t.setPriority(ACE_Based::High);
|
||||
=======
|
||||
ACE_Based::Thread t(fdr);
|
||||
t.setPriority(ACE_Based::Highest);
|
||||
>>>>>>> ca55c2a9d069aaef0d3deafb4884bfd8d3884444:src/mangosd/Master.cpp
|
||||
}
|
||||
|
||||
///- Launch the world listener socket
|
||||
@@ -353,9 +360,10 @@ int Master::Run()
|
||||
|
||||
sLog.outString( "Halting process..." );
|
||||
|
||||
#ifdef WIN32
|
||||
if (sConfig.GetBoolDefault("Console.Enable", true))
|
||||
if(cliThread)
|
||||
{
|
||||
#ifdef WIN32
|
||||
|
||||
// this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API)
|
||||
//_exit(1);
|
||||
// send keyboard input to safely unblock the CLI thread
|
||||
@@ -390,8 +398,17 @@ int Master::Run()
|
||||
b[3].Event.KeyEvent.wRepeatCount = 1;
|
||||
DWORD numb;
|
||||
BOOL ret = WriteConsoleInput(hStdIn, b, 4, &numb);
|
||||
|
||||
cliThread->wait();
|
||||
|
||||
#else
|
||||
|
||||
cliThread->destroy();
|
||||
|
||||
#endif
|
||||
|
||||
delete cliThread;
|
||||
}
|
||||
#endif
|
||||
|
||||
// for some unknown reason, unloading scripts here and not in worldrunnable
|
||||
// fixes a memory leak related to detaching threads from the module
|
||||
|
||||
Reference in New Issue
Block a user