diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-12-15 12:06:59 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-12-15 12:06:59 +0100 |
commit | d958bfd0f32bfe798809b72c1b51c990edfe141c (patch) | |
tree | c9c85d770db94239bc24679f31f2c015653b8daa /src/server/database/Database/MySQLConnection.h | |
parent | ee95a5e00fb2ee6928a819699ab93094d916d372 (diff) |
Core/Database: Replace DatabaseWorker with asio io_context
Diffstat (limited to 'src/server/database/Database/MySQLConnection.h')
-rw-r--r-- | src/server/database/Database/MySQLConnection.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/server/database/Database/MySQLConnection.h b/src/server/database/Database/MySQLConnection.h index b6656d42d91..df42cd3a342 100644 --- a/src/server/database/Database/MySQLConnection.h +++ b/src/server/database/Database/MySQLConnection.h @@ -18,6 +18,7 @@ #ifndef _MYSQLCONNECTION_H #define _MYSQLCONNECTION_H +#include "AsioHacksFwd.h" #include "Define.h" #include "DatabaseEnvFwd.h" #include <memory> @@ -25,12 +26,7 @@ #include <string> #include <vector> -template <typename T> -class ProducerConsumerQueue; - -class DatabaseWorker; class MySQLPreparedStatement; -class SQLOperation; enum ConnectionFlags { @@ -81,7 +77,8 @@ class TC_DATABASE_API MySQLConnection uint32 GetLastError(); - void StartDatabaseWorkerThread(ProducerConsumerQueue<SQLOperation*>* queue); + void StartWorkerThread(Trinity::Asio::IoContext* context); + std::thread::id GetWorkerThreadId() const; protected: /// Tries to acquire lock. If lock is acquired by another thread @@ -106,7 +103,7 @@ class TC_DATABASE_API MySQLConnection private: bool _HandleMySQLErrno(uint32 errNo, uint8 attempts = 5); - std::unique_ptr<DatabaseWorker> m_worker; //!< Core worker task. + std::unique_ptr<std::thread> m_workerThread; //!< Core worker thread. MySQLHandle* m_Mysql; //!< MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //!< Connection info (used for logging) ConnectionFlags m_connectionFlags; //!< Connection flags (for preparing relevant statements) |