mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7810] Moved ZThread related code on ACE framework.
Remove ZThread source code from mangos. Signed-off-by: AlexDereka <dereka.alex@gmail.com>
This commit is contained in:
parent
f117ce3420
commit
2aff48cc5d
182 changed files with 684 additions and 21041 deletions
|
|
@ -21,7 +21,7 @@
|
|||
#include "Util.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Platform/Define.h"
|
||||
#include "../src/zthread/ThreadImpl.h"
|
||||
#include "Threading.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Database/MySQLDelayThread.h"
|
||||
#include "Database/SqlOperations.h"
|
||||
|
|
@ -187,7 +187,7 @@ QueryResult* DatabaseMysql::Query(const char *sql)
|
|||
|
||||
{
|
||||
// guarded block for thread-safe mySQL request
|
||||
ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex);
|
||||
ACE_Guard<ACE_Thread_Mutex> query_connection_guard(mMutex);
|
||||
#ifdef MANGOS_DEBUG
|
||||
uint32 _s = getMSTime();
|
||||
#endif
|
||||
|
|
@ -235,7 +235,7 @@ bool DatabaseMysql::Execute(const char *sql)
|
|||
// don't use queued execution if it has not been initialized
|
||||
if (!m_threadBody) return DirectExecute(sql);
|
||||
|
||||
tranThread = ZThread::ThreadImpl::current(); // owner of this transaction
|
||||
tranThread = ACE_Based::Thread::current(); // owner of this transaction
|
||||
TransactionQueues::iterator i = m_tranQueues.find(tranThread);
|
||||
if (i != m_tranQueues.end() && i->second != NULL)
|
||||
{ // Statement for transaction
|
||||
|
|
@ -257,7 +257,8 @@ bool DatabaseMysql::DirectExecute(const char* sql)
|
|||
|
||||
{
|
||||
// guarded block for thread-safe mySQL request
|
||||
ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex);
|
||||
ACE_Guard<ACE_Thread_Mutex> query_connection_guard(mMutex);
|
||||
|
||||
#ifdef MANGOS_DEBUG
|
||||
uint32 _s = getMSTime();
|
||||
#endif
|
||||
|
|
@ -302,8 +303,9 @@ bool DatabaseMysql::BeginTransaction()
|
|||
// don't use queued execution if it has not been initialized
|
||||
if (!m_threadBody)
|
||||
{
|
||||
if (tranThread==ZThread::ThreadImpl::current())
|
||||
if (tranThread == ACE_Based::Thread::current())
|
||||
return false; // huh? this thread already started transaction
|
||||
|
||||
mMutex.acquire();
|
||||
if (!_TransactionCmd("START TRANSACTION"))
|
||||
{
|
||||
|
|
@ -313,7 +315,7 @@ bool DatabaseMysql::BeginTransaction()
|
|||
return true; // transaction started
|
||||
}
|
||||
|
||||
tranThread = ZThread::ThreadImpl::current(); // owner of this transaction
|
||||
tranThread = ACE_Based::Thread::current(); // owner of this transaction
|
||||
TransactionQueues::iterator i = m_tranQueues.find(tranThread);
|
||||
if (i != m_tranQueues.end() && i->second != NULL)
|
||||
// If for thread exists queue and also contains transaction
|
||||
|
|
@ -333,7 +335,7 @@ bool DatabaseMysql::CommitTransaction()
|
|||
// don't use queued execution if it has not been initialized
|
||||
if (!m_threadBody)
|
||||
{
|
||||
if (tranThread!=ZThread::ThreadImpl::current())
|
||||
if (tranThread != ACE_Based::Thread::current())
|
||||
return false;
|
||||
bool _res = _TransactionCmd("COMMIT");
|
||||
tranThread = NULL;
|
||||
|
|
@ -341,7 +343,7 @@ bool DatabaseMysql::CommitTransaction()
|
|||
return _res;
|
||||
}
|
||||
|
||||
tranThread = ZThread::ThreadImpl::current();
|
||||
tranThread = ACE_Based::Thread::current();
|
||||
TransactionQueues::iterator i = m_tranQueues.find(tranThread);
|
||||
if (i != m_tranQueues.end() && i->second != NULL)
|
||||
{
|
||||
|
|
@ -361,7 +363,7 @@ bool DatabaseMysql::RollbackTransaction()
|
|||
// don't use queued execution if it has not been initialized
|
||||
if (!m_threadBody)
|
||||
{
|
||||
if (tranThread!=ZThread::ThreadImpl::current())
|
||||
if (tranThread != ACE_Based::Thread::current())
|
||||
return false;
|
||||
bool _res = _TransactionCmd("ROLLBACK");
|
||||
tranThread = NULL;
|
||||
|
|
@ -369,7 +371,7 @@ bool DatabaseMysql::RollbackTransaction()
|
|||
return _res;
|
||||
}
|
||||
|
||||
tranThread = ZThread::ThreadImpl::current();
|
||||
tranThread = ACE_Based::Thread::current();
|
||||
TransactionQueues::iterator i = m_tranQueues.find(tranThread);
|
||||
if (i != m_tranQueues.end() && i->second != NULL)
|
||||
{
|
||||
|
|
@ -392,7 +394,8 @@ void DatabaseMysql::InitDelayThread()
|
|||
assert(!m_delayThread);
|
||||
|
||||
//New delay thread for delay execute
|
||||
m_delayThread = new ZThread::Thread(m_threadBody = new MySQLDelayThread(this));
|
||||
m_threadBody = new MySQLDelayThread(this);
|
||||
m_delayThread = new ACE_Based::Thread(*m_threadBody);
|
||||
}
|
||||
|
||||
void DatabaseMysql::HaltDelayThread()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue