summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------Theron0
-rw-r--r--lib/block_actor.cpp13
2 files changed, 10 insertions, 3 deletions
diff --git a/Theron b/Theron
-Subproject 1d3b0b2dce36ae38981303b13aff705e20f0f07
+Subproject c4eedbd3c7541ef62e520479d9494446fffea0e
diff --git a/lib/block_actor.cpp b/lib/block_actor.cpp
index 0b0199b..e522624 100644
--- a/lib/block_actor.cpp
+++ b/lib/block_actor.cpp
@@ -16,6 +16,7 @@
#include <gnuradio/thread_pool.hpp>
#include <gras_impl/block_actor.hpp>
+#include <boost/thread/thread.hpp>
#include <Theron/Framework.h>
using namespace gnuradio;
@@ -34,10 +35,16 @@ ThreadPool::ThreadPool(boost::weak_ptr<Theron::Framework> p):
//NOP
}
-ThreadPool::ThreadPool(const unsigned long threadCount)
+const size_t default_concurrency(void)
{
- if (threadCount == 0) this->reset(new Theron::Framework(Theron::Framework::Parameters()));
- else this->reset(new Theron::Framework(Theron::Framework::Parameters(threadCount)));
+ const size_t n = boost::thread::hardware_concurrency();
+ return std::max(size_t(2), n);
+}
+
+ThreadPool::ThreadPool(unsigned long threadCount)
+{
+ if (threadCount == 0) threadCount = default_concurrency();
+ this->reset(new Theron::Framework(Theron::Framework::Parameters(threadCount, 0)));
}
ThreadPool::ThreadPool(const unsigned long threadCount, const unsigned long nodeMask)