From db5c9c114e07b1751001600e9474884a28c0f68f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 19 Aug 2006 19:29:33 +0000 Subject: [PATCH] Queries in plugin_end() now resolve correctly. --- dlls/mysqlx/threading.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/mysqlx/threading.cpp b/dlls/mysqlx/threading.cpp index 85451d47..c38a6a73 100644 --- a/dlls/mysqlx/threading.cpp +++ b/dlls/mysqlx/threading.cpp @@ -17,7 +17,7 @@ void ShutdownThreading() { if (g_pWorker) { - g_pWorker->Stop(true); + g_pWorker->Stop(false); delete g_pWorker; g_pWorker = NULL; } @@ -312,11 +312,32 @@ void StartFrame() void OnPluginsUnloading() { if (!g_pWorker) + { return; + } g_pWorker->Stop(false); delete g_pWorker; g_pWorker = NULL; + + g_QueueLock->Lock(); + size_t remaining = g_ThreadQueue.size(); + if (remaining) + { + MysqlThread *kmThread; + do + { + kmThread = g_ThreadQueue.front(); + g_ThreadQueue.pop(); + g_QueueLock->Unlock(); + kmThread->Execute(); + kmThread->Invalidate(); + g_FreeThreads.push(kmThread); + g_QueueLock->Lock(); + } while (!g_ThreadQueue.empty()); + } + + g_QueueLock->Unlock(); } /***********************