From e0d45f6dff3afe5caa38c48646f23d966c8c03a1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 15 Dec 2023 12:06:59 +0100 Subject: Core/Database: Replace DatabaseWorker with asio io_context (cherry picked from commit d958bfd0f32bfe798809b72c1b51c990edfe141c) --- src/server/database/Database/MySQLConnection.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/server/database/Database/MySQLConnection.h') 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 @@ -25,12 +26,7 @@ #include #include -template -class ProducerConsumerQueue; - -class DatabaseWorker; class MySQLPreparedStatement; -class SQLOperation; enum ConnectionFlags { @@ -81,7 +77,8 @@ class TC_DATABASE_API MySQLConnection uint32 GetLastError(); - void StartDatabaseWorkerThread(ProducerConsumerQueue* 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 m_worker; //!< Core worker task. + std::unique_ptr 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) -- cgit v1.2.3