Commit 8057fb5735547358e8c8e3f4486ab49394b2e6b0

Authored by Charles Otto
1 parent 6a7b6b64

Create resources proportional to Globals->parallelism

Expose Globals in resource.h, initialize Resource objects with
Globals->parallelism resources, rather than idealThreadCount
Showing 1 changed file with 2 additions and 1 deletions
openbr/core/resource.h
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 #include <QSharedPointer> 24 #include <QSharedPointer>
25 #include <QString> 25 #include <QString>
26 #include <QThread> 26 #include <QThread>
  27 +#include <openbr/openbr_plugin.h>
27 28
28 template <typename T> 29 template <typename T>
29 class ResourceMaker 30 class ResourceMaker
@@ -52,7 +53,7 @@ public: @@ -52,7 +53,7 @@ public:
52 : resourceMaker(rm) 53 : resourceMaker(rm)
53 , availableResources(new QList<T*>()) 54 , availableResources(new QList<T*>())
54 , lock(new QMutex()) 55 , lock(new QMutex())
55 - , totalResources(new QSemaphore(QThread::idealThreadCount())) 56 + , totalResources(new QSemaphore(br::Globals->parallelism))
56 {} 57 {}
57 58
58 ~Resource() 59 ~Resource()