summaryrefslogtreecommitdiffstats
path: root/src/analyzer/analyzerqueue.cpp
diff options
context:
space:
mode:
authorUwe Klotz <uwe_klotz@web.de>2017-06-21 22:58:58 +0200
committerUwe Klotz <uwe_klotz@web.de>2017-06-21 23:01:06 +0200
commit376164dae9d54521dd5b498f37e526ba44a0f000 (patch)
treea01ae8b80cce166152776804ce429a546665dd86 /src/analyzer/analyzerqueue.cpp
parentd86694eb5a7ecfd6695ed2a7b12e1cc3e0ee0caa (diff)
Explain usage of thread-local database connection
Diffstat (limited to 'src/analyzer/analyzerqueue.cpp')
-rw-r--r--src/analyzer/analyzerqueue.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/analyzer/analyzerqueue.cpp b/src/analyzer/analyzerqueue.cpp
index 6f25bbd195..99169da474 100644
--- a/src/analyzer/analyzerqueue.cpp
+++ b/src/analyzer/analyzerqueue.cpp
@@ -302,21 +302,22 @@ void AnalyzerQueue::run() {
}
void AnalyzerQueue::execThread() {
+ // The thread-local database connection for waveform anylsis must not
+ // be closed before returning from this function. Therefore the
+ // DbConnectionPooler is defined at the outher function scope,
+ // independent of whether a database connection is opened or not.
mixxx::DbConnectionPooler dbConnectionPooler;
+ // m_pAnalysisDao remains null if no analyzer needs database access.
+ // Currently only waveform analyses makes use of it.
if (m_pAnalysisDao) {
- // Only create/open a new database connection for when needed
- // for storing waveform analyses
dbConnectionPooler = mixxx::DbConnectionPooler(m_pDbConnectionPool);
if (!dbConnectionPooler) {
kLogger.warning()
<< "Failed to open database connection for analyzer queue thread";
return;
}
- // Use the newly created database connection for this thread
+ // Obtain and use the newly created database connection within this thread
m_pAnalysisDao->initialize(mixxx::DbConnectionPooled(m_pDbConnectionPool));
- // The database connection is valid until dbConnectionPooler is destroyed
- // when exiting the enclosing function scope. The pooler as the owner of
- // the connection must not be destroyed now!
}
m_progressInfo.current_track.reset();