- Call mysql_thread_end() for every deleted MySQLConnection instance, should fix the ¨Error in my_thread_global_end(): X threads didn't exit¨ issue. (Thanks to Aokromes for testing)

- Add some debug info to help trace down the other causes of the shutdown crash.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-08-19 16:35:52 +02:00
parent 7d915911f9
commit 46438f9f92
3 changed files with 11 additions and 3 deletions
@@ -59,6 +59,7 @@ bool DatabaseWorkerPool::Open(const std::string& infoString, uint8 num_threads)
void DatabaseWorkerPool::Close()
{
DEBUG_LOG("Closing down %u connections on this DatabaseWorkerPool", (uint32)m_connections.value());
/// Shuts down worker threads for this connection pool.
ACE_Thread_Mutex shutdown_Mtx;
ACE_Condition_Thread_Mutex m_condition(shutdown_Mtx);
@@ -66,15 +67,18 @@ void DatabaseWorkerPool::Close()
{
Enqueue(new DatabaseWorkerPoolEnd(m_condition));
m_condition.wait();
--m_connections;
}
m_queue->queue()->deactivate();
delete m_bundle_conn;
m_bundle_conn = NULL;
--m_connections;
DEBUG_LOG("Closed bundled connection.");
//- MySQL::Thread_End() should be called manually from the aborting calling threads
DEBUG_LOG("Waiting for synchroneous database threads to exit.");
DEBUG_LOG("Waiting for %u synchroneous database threads to exit.", (uint32)m_connections.value());
while (!m_sync_connections.empty())
{
}
@@ -98,6 +102,8 @@ void DatabaseWorkerPool::Init_MySQL_Connection()
sLog.outDebug("Core thread with ID ["UI64FMTD"] initializing MySQL connection.",
(uint64)ACE_Based::Thread::currentId());
++m_connections;
}
void DatabaseWorkerPool::End_MySQL_Connection()
@@ -111,6 +117,7 @@ void DatabaseWorkerPool::End_MySQL_Connection()
}
delete conn;
conn = NULL;
--m_connections;
}
void DatabaseWorkerPool::Execute(const char* sql)