mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 17:43:59 +02:00
* Made the pipeline cleverer when it comes to using threads.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include "functimeout.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#define CONCURRENT_QUERIES 4
|
||||
#define DEFAULT_CONCURRENT_QUERIES 4
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@@ -44,6 +44,9 @@ Pipeline::Pipeline( QObject* parent )
|
||||
, m_running( false )
|
||||
{
|
||||
s_instance = this;
|
||||
|
||||
m_maxConcurrentQueries = qMax( DEFAULT_CONCURRENT_QUERIES, QThread::idealThreadCount() * 2 );
|
||||
qDebug() << Q_FUNC_INFO << "Using" << m_maxConcurrentQueries << "threads";
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +247,7 @@ Pipeline::shuntNext()
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << m_qidsState.count();
|
||||
// Check if we are ready to dispatch more queries
|
||||
if ( m_qidsState.count() >= CONCURRENT_QUERIES )
|
||||
if ( m_qidsState.count() >= m_maxConcurrentQueries )
|
||||
return;
|
||||
|
||||
/*
|
||||
|
@@ -104,6 +104,7 @@ private:
|
||||
|
||||
// store queries here until DB index is loaded, then shunt them all
|
||||
QList< query_ptr > m_queries_pending;
|
||||
int m_maxConcurrentQueries;
|
||||
bool m_running;
|
||||
|
||||
static Pipeline* s_instance;
|
||||
|
Reference in New Issue
Block a user