*Merge 1600 from tc1.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-06-27 17:15:38 +02:00
parent e7e79ff8a4
commit ab7e83a72c
6 changed files with 21 additions and 16 deletions

View File

@@ -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();
}