From 3fc438ffd1ce244718d7f05fc10d0c39d04530a7 Mon Sep 17 00:00:00 2001 From: HttrckCldHKS Date: Tue, 17 Feb 2015 16:04:42 +0200 Subject: [PATCH] Fix SQL modules threading system. --- dlls/mysqlx/AMBuilder | 2 +- dlls/mysqlx/msvc12/mysqlx.vcxproj | 6 +++--- dlls/mysqlx/mysql/MysqlHeaders.h | 2 +- dlls/mysqlx/thread/ThreadWorker.h | 2 +- dlls/mysqlx/threading.cpp | 8 ++++++-- dlls/sqlite/thread/ThreadWorker.h | 2 +- dlls/sqlite/threading.cpp | 8 ++++++-- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/dlls/mysqlx/AMBuilder b/dlls/mysqlx/AMBuilder index 82c40ab0..0a6d93b0 100644 --- a/dlls/mysqlx/AMBuilder +++ b/dlls/mysqlx/AMBuilder @@ -27,7 +27,7 @@ if AMXX.mysql_path: binary.compiler.linkflags += [ os.path.join(AMXX.mysql_path, 'lib', 'opt', 'mysqlclient.lib'), os.path.join(AMXX.mysql_path, 'lib', 'opt', 'zlib.lib'), - 'wsock32.lib' + 'ws2_32.lib' ] binary.sources = [ diff --git a/dlls/mysqlx/msvc12/mysqlx.vcxproj b/dlls/mysqlx/msvc12/mysqlx.vcxproj index 56dc48d3..1f0462f0 100644 --- a/dlls/mysqlx/msvc12/mysqlx.vcxproj +++ b/dlls/mysqlx/msvc12/mysqlx.vcxproj @@ -66,8 +66,8 @@ ProgramDatabase - wsock32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies) - LIBCMT;LIBCMT;%(IgnoreSpecificDefaultLibraries) + ws2_32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies) + LIBCMT;%(IgnoreSpecificDefaultLibraries) true $(OutDir)mysql2.pdb Windows @@ -88,7 +88,7 @@ ProgramDatabase - wsock32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies) + ws2_32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) true Windows diff --git a/dlls/mysqlx/mysql/MysqlHeaders.h b/dlls/mysqlx/mysql/MysqlHeaders.h index 40285576..118aebab 100644 --- a/dlls/mysqlx/mysql/MysqlHeaders.h +++ b/dlls/mysqlx/mysql/MysqlHeaders.h @@ -30,7 +30,7 @@ #include #if defined WIN32 || defined _WIN32 -#include +#include #endif typedef unsigned long ulong; #include diff --git a/dlls/mysqlx/thread/ThreadWorker.h b/dlls/mysqlx/thread/ThreadWorker.h index ec9db997..fbe3bf48 100644 --- a/dlls/mysqlx/thread/ThreadWorker.h +++ b/dlls/mysqlx/thread/ThreadWorker.h @@ -12,7 +12,7 @@ #include "BaseWorker.h" -#define DEFAULT_THINK_TIME_MS 200 +#define DEFAULT_THINK_TIME_MS 25 class ThreadWorker : public BaseWorker, public IThread { diff --git a/dlls/mysqlx/threading.cpp b/dlls/mysqlx/threading.cpp index eba5cc99..27b87557 100644 --- a/dlls/mysqlx/threading.cpp +++ b/dlls/mysqlx/threading.cpp @@ -29,6 +29,8 @@ void ShutdownThreading() { if (g_pWorker) { + // Flush all the remaining job fast! + g_pWorker->SetMaxThreadsPerFrame(8192); g_pWorker->Stop(true); delete g_pWorker; g_pWorker = NULL; @@ -316,7 +318,7 @@ void OnPluginsLoaded() g_QueueLock = g_Threader.MakeMutex(); } - g_pWorker = new ThreadWorker(&g_Threader, 250); + g_pWorker = new ThreadWorker(&g_Threader, DEFAULT_THINK_TIME_MS); if (!g_pWorker->Start()) { delete g_pWorker; @@ -333,7 +335,7 @@ void StartFrame() { if (g_pWorker && (g_lasttime < gpGlobals->time)) { - g_lasttime = gpGlobals->time + 0.05f; + g_lasttime = gpGlobals->time + 0.025f; g_QueueLock->Lock(); size_t remaining = g_ThreadQueue.size(); if (remaining) @@ -364,6 +366,8 @@ void OnPluginsUnloading() return; } + // Flush all the remaining job fast! + g_pWorker->SetMaxThreadsPerFrame(8192); g_pWorker->Stop(false); delete g_pWorker; g_pWorker = NULL; diff --git a/dlls/sqlite/thread/ThreadWorker.h b/dlls/sqlite/thread/ThreadWorker.h index 9b66bc38..fbe3bf48 100644 --- a/dlls/sqlite/thread/ThreadWorker.h +++ b/dlls/sqlite/thread/ThreadWorker.h @@ -12,7 +12,7 @@ #include "BaseWorker.h" -#define DEFAULT_THINK_TIME_MS 500 +#define DEFAULT_THINK_TIME_MS 25 class ThreadWorker : public BaseWorker, public IThread { diff --git a/dlls/sqlite/threading.cpp b/dlls/sqlite/threading.cpp index 61954fe1..989cfdc5 100644 --- a/dlls/sqlite/threading.cpp +++ b/dlls/sqlite/threading.cpp @@ -28,6 +28,8 @@ void ShutdownThreading() { if (g_pWorker) { + // Flush all the remaining job fast! + g_pWorker->SetMaxThreadsPerFrame(8192); g_pWorker->Stop(true); delete g_pWorker; g_pWorker = NULL; @@ -293,7 +295,7 @@ void OnPluginsLoaded() g_QueueLock = g_Threader.MakeMutex(); } - g_pWorker = new ThreadWorker(&g_Threader, 250); + g_pWorker = new ThreadWorker(&g_Threader, DEFAULT_THINK_TIME_MS); if (!g_pWorker->Start()) { delete g_pWorker; @@ -310,7 +312,7 @@ void StartFrame() { if (g_pWorker && (g_lasttime < gpGlobals->time)) { - g_lasttime = gpGlobals->time + 0.05f; + g_lasttime = gpGlobals->time + 0.025f; g_QueueLock->Lock(); size_t remaining = g_ThreadQueue.size(); if (remaining) @@ -341,6 +343,8 @@ void OnPluginsUnloading() return; } + // Flush all the remaining job fast! + g_pWorker->SetMaxThreadsPerFrame(8192); g_pWorker->Stop(false); delete g_pWorker; g_pWorker = NULL;