Merge pull request #7037 from def-/pr-shutdown-stuck

Shut down db connection pool (fixes #7036)
This commit is contained in:
Robert Müller 2023-08-17 18:35:34 +00:00 committed by GitHub
commit 6f47235edc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -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)

View file

@ -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