Merge pull request #207 from ClaudiuHKS/MySQLThreadingFix

Fix SQL Modules Threading
This commit is contained in:
Vincent Herbet 2015-02-18 19:34:18 +01:00
commit 2b9e9c79b9
7 changed files with 19 additions and 11 deletions

View File

@ -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 = [

View File

@ -66,8 +66,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>wsock32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>ws2_32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)mysql2.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
@ -88,7 +88,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>wsock32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;..\..\..\..\mysql-5.0\lib\opt\mysqlclient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>

View File

@ -30,7 +30,7 @@
#include <ISQLDriver.h>
#if defined WIN32 || defined _WIN32
#include <winsock.h>
#include <WinSock2.h>
#endif
typedef unsigned long ulong;
#include <mysql.h>

View File

@ -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
{

View File

@ -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;

View File

@ -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
{

View File

@ -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;