From b845b9d0fdd93a8f772ef1c945c63bb473a7e824 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Sun, 5 Dec 2010 16:48:47 +0100 Subject: Core/DBLayer: - Make time format of MaxPingTime consistent between authserver and worldserver. Note that the value is in minutes, update your config files accordingly if needed. - Remove obsolete atomic uint32 and prevent concurrent calls to vector::size() in DatabaseWorkerPool --HG-- branch : trunk --- src/server/shared/Database/DatabaseWorkerPool.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/server/shared/Database') diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 5cfb8af2155..6de6cf630c0 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -18,7 +18,6 @@ #ifndef _DATABASEWORKERPOOL_H #define _DATABASEWORKERPOOL_H -#include #include #include "Common.h" @@ -53,9 +52,6 @@ class DatabaseWorkerPool { template friend class DatabaseWorker; - private: - typedef ACE_Atomic_Op AtomicUInt; - public: DatabaseWorkerPool() : m_queue(new ACE_Activation_Queue(new ACE_Message_Queue)), @@ -90,7 +86,7 @@ class DatabaseWorkerPool for (uint8 i = 0; i < delaythreads; ++i) m_delaythreads[i] = new DatabaseWorker(m_queue, this); - sLog.outSQLDriver("Databasepool opened succesfuly. %u connections running.", (uint32)m_connectionCount.value()); + sLog.outSQLDriver("Databasepool opened succesfuly. %u connections running.", m_connectionCount); return true; } @@ -105,7 +101,7 @@ class DatabaseWorkerPool m_delaythreads[i]->wait(); /// Shut down the connections - for (uint8 i = 0; i < m_connections.size(); ++i) + for (uint8 i = 0; i < m_connectionCount; ++i) { T* t = m_connections[i]; while (1) @@ -302,7 +298,7 @@ class DatabaseWorkerPool void KeepAlive() { /// Ping connections - for (uint8 i = 0; i < m_connections.size(); ++i) + for (uint8 i = 0; i < m_connectionCount; ++i) { T* t = m_connections[i]; if (t->LockIfReady()) @@ -319,7 +315,7 @@ class DatabaseWorkerPool uint8 i = 0; for (;;) /// Block forever until a connection is free { - T* t = m_connections[++i % m_connectionCount.value()]; + T* t = m_connections[++i % m_connectionCount]; if (t->LockIfReady()) /// Must be matched with t->Unlock() or you will get deadlocks return t; } @@ -350,7 +346,7 @@ class DatabaseWorkerPool ACE_Activation_Queue* m_queue; //! Queue shared by async worker threads. std::vector m_connections; - AtomicUInt m_connectionCount; //! Counter of MySQL connections; + uint8 m_connectionCount; //! Counter of MySQL connections; MySQLConnectionInfo m_connectionInfo; std::vector*> m_delaythreads; //! Delaythreads (templatized) }; -- cgit v1.2.3