summaryrefslogtreecommitdiff
path: root/lib/block_actor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/block_actor.cpp')
-rw-r--r--lib/block_actor.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/block_actor.cpp b/lib/block_actor.cpp
index af59009..61660f9 100644
--- a/lib/block_actor.cpp
+++ b/lib/block_actor.cpp
@@ -15,14 +15,25 @@
// along with io_sig program. If not, see <http://www.gnu.org/licenses/>.
#include <gras_impl/block_actor.hpp>
+#include <boost/thread/thread.hpp>
#include <Theron/Framework.h>
using namespace gnuradio;
-static Theron::Framework global_framework(8); //TODO needs API config
+static size_t hardware_concurrency(void)
+{
+ const size_t n = boost::thread::hardware_concurrency();
+ return std::max(size_t(2), n);
+}
+
+static Theron::Framework &get_global_framework(void)
+{
+ static Theron::Framework framework(hardware_concurrency());
+ return framework;
+}
BlockActor::BlockActor(void):
- Apology::Worker(global_framework)
+ Apology::Worker(get_global_framework())
{
this->register_handlers();
}