Replace all uses of AMTL threads with STL threads.
This also rewrites the work loop for threaded queries. It has been simplified significantly.
This commit is contained in:
@@ -277,17 +277,13 @@ IPreparedQuery *MyDatabase::PrepareQuery(const char *query, char *error, size_t
|
||||
|
||||
bool MyDatabase::LockForFullAtomicOperation()
|
||||
{
|
||||
if (!m_FullLock)
|
||||
m_FullLock = new ke::Mutex();
|
||||
|
||||
m_FullLock->Lock();
|
||||
m_FullLock.lock();
|
||||
return true;
|
||||
}
|
||||
|
||||
void MyDatabase::UnlockFromFullAtomicOperation()
|
||||
{
|
||||
if (m_FullLock)
|
||||
m_FullLock->Unlock();
|
||||
m_FullLock.unlock();
|
||||
}
|
||||
|
||||
IDBDriver *MyDatabase::GetDriver()
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#ifndef _INCLUDE_SM_MYSQL_DATABASE_H_
|
||||
#define _INCLUDE_SM_MYSQL_DATABASE_H_
|
||||
|
||||
#include <am-thread-utils.h>
|
||||
#include <am-refcounting-threadsafe.h>
|
||||
#include <mutex>
|
||||
#include "MyDriver.h"
|
||||
|
||||
class MyQuery;
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
const DatabaseInfo &GetInfo();
|
||||
private:
|
||||
MYSQL *m_mysql;
|
||||
ke::AutoPtr<ke::Mutex> m_FullLock;
|
||||
std::mutex m_FullLock;
|
||||
|
||||
/* ---------- */
|
||||
DatabaseInfo m_Info;
|
||||
|
||||
@@ -160,7 +160,7 @@ bool CompareField(const char *str1, const char *str2)
|
||||
|
||||
IDatabase *MyDriver::Connect(const DatabaseInfo *info, bool persistent, char *error, size_t maxlength)
|
||||
{
|
||||
ke::AutoLock lock(&m_Lock);
|
||||
std::lock_guard<std::mutex> lock(m_Lock);
|
||||
|
||||
if (persistent)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ IDatabase *MyDriver::Connect(const DatabaseInfo *info, bool persistent, char *er
|
||||
|
||||
void MyDriver::RemoveFromList(MyDatabase *pdb, bool persistent)
|
||||
{
|
||||
ke::AutoLock lock(&m_Lock);
|
||||
std::lock_guard<std::mutex> lock(m_Lock);
|
||||
if (persistent)
|
||||
{
|
||||
m_PermDbs.remove(pdb);
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
|
||||
#include <sh_string.h>
|
||||
#include <sh_list.h>
|
||||
#include <am-thread-utils.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
using namespace SourceMod;
|
||||
using namespace SourceHook;
|
||||
@@ -71,7 +72,7 @@ public:
|
||||
void Shutdown();
|
||||
void RemoveFromList(MyDatabase *pdb, bool persistent);
|
||||
private:
|
||||
ke::Mutex m_Lock;
|
||||
std::mutex m_Lock;
|
||||
Handle_t m_MyHandle;
|
||||
List<MyDatabase *> m_TempDbs;
|
||||
List<MyDatabase *> m_PermDbs;
|
||||
|
||||
Reference in New Issue
Block a user