diff --git a/src/engine/server/databases/connection_pool.cpp b/src/engine/server/databases/connection_pool.cpp index 07e9b0efe..2ea2e3d9e 100644 --- a/src/engine/server/databases/connection_pool.cpp +++ b/src/engine/server/databases/connection_pool.cpp @@ -160,6 +160,9 @@ void CDbConnectionPool::ExecuteWrite( void CDbConnectionPool::OnShutdown() { + if(m_Shutdown) + return; + m_Shutdown = true; m_pShared->m_Shutdown.store(true); m_pShared->m_NumBackup.Signal(); int i = 0; @@ -470,6 +473,7 @@ CDbConnectionPool::CDbConnectionPool() CDbConnectionPool::~CDbConnectionPool() { + OnShutdown(); if(m_pWorkerThread) thread_wait(m_pWorkerThread); if(m_pBackupThread) diff --git a/src/engine/server/databases/connection_pool.h b/src/engine/server/databases/connection_pool.h index 040941118..87b7f2dc5 100644 --- a/src/engine/server/databases/connection_pool.h +++ b/src/engine/server/databases/connection_pool.h @@ -104,6 +104,8 @@ private: // where the next query is added to the queue. int m_InsertIdx = 0; + bool m_Shutdown = false; + struct CSharedData { // Used as signal that shutdown is in progress from main thread to