mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Database: Replace DatabaseWorker with asio io_context
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user