Dynamic thread count for preview/thumb updaters based on processor core count

This commit is contained in:
Oliver Duis
2010-10-29 14:54:54 +02:00
parent 35f228044b
commit 2502010850
2 changed files with 23 additions and 8 deletions

View File

@@ -21,8 +21,9 @@
#include <previewloader.h>
#include <guiutils.h>
#define THREAD_NUM 4
#ifdef _OPENMP
#include <omp.h>
#endif
#define DEBUG(format,args...)
//#define DEBUG(format,args...) printf("PreviewLoader::%s: " format "\n", __FUNCTION__, ## args)
@@ -62,9 +63,15 @@ public:
typedef std::set<Job,JobCompare> JobSet;
Impl():
threadPool_(new Glib::ThreadPool(THREAD_NUM,0))
{}
Impl()
{
int threadCount=1;
#ifdef _OPENMP
threadCount=omp_get_num_procs();
#endif
threadPool_=new Glib::ThreadPool(threadCount,0);
}
Glib::ThreadPool* threadPool_;

View File

@@ -22,7 +22,9 @@
#include <gtkmm.h>
#include <guiutils.h>
#define THREAD_NUM 2
#ifdef _OPENMP
#include <omp.h>
#endif
#define DEBUG(format,args...)
//#define DEBUG(format,args...) printf("ThumbImageUpdate::%s: " format "\n", __FUNCTION__, ## args)
@@ -61,10 +63,16 @@ public:
typedef std::list<Job> JobList;
Impl():
threadPool_(new Glib::ThreadPool(THREAD_NUM,0)),
active_(0),
inactive_waiting_(false)
{}
{
int threadCount=1;
#ifdef _OPENMP
threadCount=omp_get_num_procs();
#endif
threadPool_=new Glib::ThreadPool(threadCount,0);
}
Glib::ThreadPool* threadPool_;