aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database/MySQLConnection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Database/MySQLConnection.h')
-rw-r--r--src/server/shared/Database/MySQLConnection.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index 93812421c8a..f83d22218dd 100644
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -25,10 +25,12 @@
class DatabaseWorker;
class PreparedStatement;
class MySQLPreparedStatement;
+class PingOperation;
class MySQLConnection
{
template <class T> friend class DatabaseWorkerPool;
+ friend class PingOperation;
public:
MySQLConnection(); //! Constructor for synchroneous connections.
@@ -36,6 +38,7 @@ class MySQLConnection
~MySQLConnection();
virtual bool Open(const std::string& infoString); //! Connection details.
+ void Close();
public:
bool Execute(const char* sql);
@@ -58,6 +61,19 @@ class MySQLConnection
void PrepareStatement(uint32 index, const char* sql);
std::vector<MySQLPreparedStatement*> m_stmts; //! PreparedStatements storage
+ bool LockIfReady()
+ {
+ /// Tries to acquire lock. If lock is acquired by another thread
+ /// the calling parent will just try another connection
+ return m_Mutex.tryacquire() != -1;
+ }
+
+ void Unlock()
+ {
+ /// Called by parent databasepool. Will let other threads access this connection
+ m_Mutex.release();
+ }
+
private:
ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections.
DatabaseWorker* m_worker; //! Core worker task.