Dynamic thread count for preview/thumb updaters based on processor core count
This commit is contained in:
@@ -21,8 +21,9 @@
|
|||||||
#include <previewloader.h>
|
#include <previewloader.h>
|
||||||
#include <guiutils.h>
|
#include <guiutils.h>
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
#define THREAD_NUM 4
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEBUG(format,args...)
|
#define DEBUG(format,args...)
|
||||||
//#define DEBUG(format,args...) printf("PreviewLoader::%s: " format "\n", __FUNCTION__, ## args)
|
//#define DEBUG(format,args...) printf("PreviewLoader::%s: " format "\n", __FUNCTION__, ## args)
|
||||||
@@ -62,9 +63,15 @@ public:
|
|||||||
|
|
||||||
typedef std::set<Job,JobCompare> JobSet;
|
typedef std::set<Job,JobCompare> JobSet;
|
||||||
|
|
||||||
Impl():
|
Impl()
|
||||||
threadPool_(new Glib::ThreadPool(THREAD_NUM,0))
|
{
|
||||||
{}
|
int threadCount=1;
|
||||||
|
#ifdef _OPENMP
|
||||||
|
threadCount=omp_get_num_procs();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
threadPool_=new Glib::ThreadPool(threadCount,0);
|
||||||
|
}
|
||||||
|
|
||||||
Glib::ThreadPool* threadPool_;
|
Glib::ThreadPool* threadPool_;
|
||||||
|
|
||||||
|
@@ -22,7 +22,9 @@
|
|||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include <guiutils.h>
|
#include <guiutils.h>
|
||||||
|
|
||||||
#define THREAD_NUM 2
|
#ifdef _OPENMP
|
||||||
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEBUG(format,args...)
|
#define DEBUG(format,args...)
|
||||||
//#define DEBUG(format,args...) printf("ThumbImageUpdate::%s: " format "\n", __FUNCTION__, ## args)
|
//#define DEBUG(format,args...) printf("ThumbImageUpdate::%s: " format "\n", __FUNCTION__, ## args)
|
||||||
@@ -61,10 +63,16 @@ public:
|
|||||||
typedef std::list<Job> JobList;
|
typedef std::list<Job> JobList;
|
||||||
|
|
||||||
Impl():
|
Impl():
|
||||||
threadPool_(new Glib::ThreadPool(THREAD_NUM,0)),
|
|
||||||
active_(0),
|
active_(0),
|
||||||
inactive_waiting_(false)
|
inactive_waiting_(false)
|
||||||
{}
|
{
|
||||||
|
int threadCount=1;
|
||||||
|
#ifdef _OPENMP
|
||||||
|
threadCount=omp_get_num_procs();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
threadPool_=new Glib::ThreadPool(threadCount,0);
|
||||||
|
}
|
||||||
|
|
||||||
Glib::ThreadPool* threadPool_;
|
Glib::ThreadPool* threadPool_;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user