mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
*Merge 1600 from tc1.
--HG-- branch : trunk
This commit is contained in:
@@ -22,8 +22,10 @@
|
||||
#include "Database/SqlOperations.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
SqlDelayThread::SqlDelayThread(Database* db) : m_dbEngine(db), m_running(true)
|
||||
SqlDelayThread::SqlDelayThread(Database* db, const char* infoString) :m_running(true)
|
||||
{
|
||||
m_dbEngine = new DatabaseType;
|
||||
((DatabaseType*)m_dbEngine)->Initialize(infoString, false);
|
||||
}
|
||||
|
||||
void SqlDelayThread::run()
|
||||
@@ -35,15 +37,16 @@ void SqlDelayThread::run()
|
||||
|
||||
while (m_running)
|
||||
{
|
||||
// if the running state gets turned off while sleeping
|
||||
// empty the queue before exiting
|
||||
ACE_Based::Thread::Sleep(10);
|
||||
while (!m_sqlQueue.empty())
|
||||
try
|
||||
{
|
||||
s = m_sqlQueue.next();
|
||||
s->Execute(m_dbEngine);
|
||||
delete s;
|
||||
}
|
||||
catch(...)
|
||||
{continue;}
|
||||
if(!s)
|
||||
continue;
|
||||
s->Execute(m_dbEngine);
|
||||
delete s;
|
||||
}
|
||||
|
||||
#ifndef DO_POSTGRESQL
|
||||
@@ -54,5 +57,6 @@ void SqlDelayThread::run()
|
||||
void SqlDelayThread::Stop()
|
||||
{
|
||||
m_running = false;
|
||||
m_sqlQueue.cancel();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user