aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Database')
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.h10
-rw-r--r--src/server/shared/Database/MySQLConnection.h8
-rw-r--r--src/server/shared/Database/QueryResult.h8
-rw-r--r--src/server/shared/Database/Transaction.h2
4 files changed, 9 insertions, 19 deletions
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index e56dcc329cd..4b9e887f341 100644
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -18,8 +18,6 @@
#ifndef _DATABASEWORKERPOOL_H
#define _DATABASEWORKERPOOL_H
-#include <ace/Thread_Mutex.h>
-
#include "Common.h"
#include "Callback.h"
#include "MySQLConnection.h"
@@ -51,7 +49,6 @@ class DatabaseWorkerPool
/* Activity state */
DatabaseWorkerPool() : _connectionInfo(NULL)
{
- _messageQueue = new ACE_Message_Queue<ACE_SYNCH>(8 * 1024 * 1024, 8 * 1024 * 1024);
_queue = new ProducerConsumerQueue<SQLOperation*>();
memset(_connectionCount, 0, sizeof(_connectionCount));
_connections.resize(IDX_SIZE);
@@ -125,9 +122,7 @@ class DatabaseWorkerPool
for (uint8 i = 0; i < _connectionCount[IDX_SYNCH]; ++i)
_connections[IDX_SYNCH][i]->Close();
- //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue
delete _queue;
- delete _messageQueue;
TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName());
@@ -410,7 +405,7 @@ class DatabaseWorkerPool
//! Will be wrapped in a transaction if valid object is present, otherwise executed standalone.
void ExecuteOrAppend(SQLTransaction& trans, PreparedStatement* stmt)
{
- if (trans.null())
+ if (!trans)
Execute(stmt);
else
trans->Append(stmt);
@@ -420,7 +415,7 @@ class DatabaseWorkerPool
//! Will be wrapped in a transaction if valid object is present, otherwise executed standalone.
void ExecuteOrAppend(SQLTransaction& trans, const char* sql)
{
- if (trans.null())
+ if (!trans)
Execute(sql);
else
trans->Append(sql);
@@ -517,7 +512,6 @@ class DatabaseWorkerPool
IDX_SIZE
};
- ACE_Message_Queue<ACE_SYNCH>* _messageQueue; //! Message Queue used by ACE_Activation_Queue
ProducerConsumerQueue<SQLOperation*>* _queue; //! Queue shared by async worker threads.
std::vector< std::vector<T*> > _connections;
uint32 _connectionCount[2]; //! Counter of MySQL connections;
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index 3b7efeb5846..61b3b37cbc2 100644
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -15,8 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ace/Activation_Queue.h>
-
#include "DatabaseWorkerPool.h"
#include "Transaction.h"
#include "Util.h"
@@ -100,13 +98,13 @@ class MySQLConnection
{
/// Tries to acquire lock. If lock is acquired by another thread
/// the calling parent will just try another connection
- return m_Mutex.tryacquire() != -1;
+ return m_Mutex.try_lock();
}
void Unlock()
{
/// Called by parent databasepool. Will let other threads access this connection
- m_Mutex.release();
+ m_Mutex.unlock();
}
MYSQL* GetHandle() { return m_Mysql; }
@@ -131,7 +129,7 @@ class MySQLConnection
MYSQL * m_Mysql; //! MySQL Handle.
MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging)
ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements)
- ACE_Thread_Mutex m_Mutex;
+ std::mutex m_Mutex;
MySQLConnection(MySQLConnection const& right) = delete;
MySQLConnection& operator=(MySQLConnection const& right) = delete;
diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h
index 4795fef4a4c..e8c277c03cf 100644
--- a/src/server/shared/Database/QueryResult.h
+++ b/src/server/shared/Database/QueryResult.h
@@ -19,9 +19,7 @@
#ifndef QUERYRESULT_H
#define QUERYRESULT_H
-#include "AutoPtr.h"
-#include <ace/Thread_Mutex.h>
-
+#include <memory>
#include "Field.h"
#ifdef _WIN32
@@ -60,7 +58,7 @@ class ResultSet
ResultSet& operator=(ResultSet const& right) = delete;
};
-typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;
+typedef std::shared_ptr<ResultSet> QueryResult;
class PreparedResultSet
{
@@ -107,7 +105,7 @@ class PreparedResultSet
PreparedResultSet& operator=(PreparedResultSet const& right) = delete;
};
-typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult;
+typedef std::shared_ptr<PreparedResultSet> PreparedQueryResult;
#endif
diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h
index cb28f0ad876..c7cbbbbe712 100644
--- a/src/server/shared/Database/Transaction.h
+++ b/src/server/shared/Database/Transaction.h
@@ -50,7 +50,7 @@ class Transaction
bool _cleanedUp;
};
-typedef Trinity::AutoPtr<Transaction, ACE_Thread_Mutex> SQLTransaction;
+typedef std::shared_ptr<Transaction> SQLTransaction;
/*! Low level class*/
class TransactionTask : public SQLOperation