Synced threading changes between MySQLX and Sqlite
This commit is contained in:
parent
db5c9c114e
commit
446d4b8a5d
|
@ -17,7 +17,7 @@ void ShutdownThreading()
|
||||||
{
|
{
|
||||||
if (g_pWorker)
|
if (g_pWorker)
|
||||||
{
|
{
|
||||||
g_pWorker->Stop(false);
|
g_pWorker->Stop(true);
|
||||||
delete g_pWorker;
|
delete g_pWorker;
|
||||||
g_pWorker = NULL;
|
g_pWorker = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,6 +263,7 @@ void OnPluginsLoaded()
|
||||||
{
|
{
|
||||||
g_QueueLock = g_Threader.MakeMutex();
|
g_QueueLock = g_Threader.MakeMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pWorker = new ThreadWorker(&g_Threader, 250);
|
g_pWorker = new ThreadWorker(&g_Threader, 250);
|
||||||
if (!g_pWorker->Start())
|
if (!g_pWorker->Start())
|
||||||
{
|
{
|
||||||
|
@ -307,16 +308,37 @@ void StartFrame()
|
||||||
void OnPluginsUnloading()
|
void OnPluginsUnloading()
|
||||||
{
|
{
|
||||||
if (!g_pWorker)
|
if (!g_pWorker)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
g_pWorker->Stop(false);
|
g_pWorker->Stop(false);
|
||||||
delete g_pWorker;
|
delete g_pWorker;
|
||||||
g_pWorker = NULL;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************
|
/***********************
|
||||||
* ATOMIC RESULT STUFF *
|
* ATOMIC RESULT STUFF *
|
||||||
***********************/
|
***********************/
|
||||||
|
|
||||||
AtomicResult::AtomicResult()
|
AtomicResult::AtomicResult()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user