Merge pull request #207 from ClaudiuHKS/MySQLThreadingFix
Fix SQL Modules Threading
This commit is contained in:
commit
2b9e9c79b9
|
@ -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 = [
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user