mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Run MysqlUninit later (fixes #6571)
This commit is contained in:
parent
6cfac056ec
commit
7e82bf3a53
|
@ -117,8 +117,6 @@ CSqlExecData::CSqlExecData(IConsole *pConsole, CDbConnectionPool::Mode m) :
|
||||||
m_Ptr.m_Print.m_Mode = m;
|
m_Ptr.m_Print.m_Mode = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDbConnectionPool::~CDbConnectionPool() = default;
|
|
||||||
|
|
||||||
void CDbConnectionPool::Print(IConsole *pConsole, Mode DatabaseMode)
|
void CDbConnectionPool::Print(IConsole *pConsole, Mode DatabaseMode)
|
||||||
{
|
{
|
||||||
m_pShared->m_aQueries[m_InsertIdx++] = std::make_unique<CSqlExecData>(pConsole, DatabaseMode);
|
m_pShared->m_aQueries[m_InsertIdx++] = std::make_unique<CSqlExecData>(pConsole, DatabaseMode);
|
||||||
|
@ -466,7 +464,14 @@ bool CDbConnectionPool::ExecSqlFunc(IDbConnection *pConnection, CSqlExecData *pD
|
||||||
CDbConnectionPool::CDbConnectionPool()
|
CDbConnectionPool::CDbConnectionPool()
|
||||||
{
|
{
|
||||||
m_pShared = std::make_shared<CSharedData>();
|
m_pShared = std::make_shared<CSharedData>();
|
||||||
|
m_pWorkerThread = thread_init(CWorker::Start, new CWorker(m_pShared), "database worker thread");
|
||||||
thread_init_and_detach(CWorker::Start, new CWorker(m_pShared), "database worker thread");
|
m_pBackupThread = thread_init(CBackup::Start, new CBackup(m_pShared), "database backup worker thread");
|
||||||
thread_init_and_detach(CBackup::Start, new CBackup(m_pShared), "database backup worker thread");
|
}
|
||||||
|
|
||||||
|
CDbConnectionPool::~CDbConnectionPool()
|
||||||
|
{
|
||||||
|
if(m_pWorkerThread)
|
||||||
|
thread_wait(m_pWorkerThread);
|
||||||
|
if(m_pBackupThread)
|
||||||
|
thread_wait(m_pBackupThread);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<CSharedData> m_pShared;
|
std::shared_ptr<CSharedData> m_pShared;
|
||||||
|
void *m_pWorkerThread = nullptr;
|
||||||
|
void *m_pBackupThread = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENGINE_SERVER_DATABASES_CONNECTION_POOL_H
|
#endif // ENGINE_SERVER_DATABASES_CONNECTION_POOL_H
|
||||||
|
|
|
@ -190,12 +190,12 @@ int main(int argc, const char **argv)
|
||||||
dbg_msg("server", "starting...");
|
dbg_msg("server", "starting...");
|
||||||
int Ret = pServer->Run();
|
int Ret = pServer->Run();
|
||||||
|
|
||||||
MysqlUninit();
|
|
||||||
secure_random_uninit();
|
|
||||||
|
|
||||||
pServerLogger->OnServerDeletion();
|
pServerLogger->OnServerDeletion();
|
||||||
// free
|
// free
|
||||||
delete pKernel;
|
delete pKernel;
|
||||||
|
|
||||||
|
MysqlUninit();
|
||||||
|
secure_random_uninit();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue