diff options
author | Josh Blum | 2013-05-11 14:19:51 -0700 |
---|---|---|
committer | Josh Blum | 2013-05-11 14:19:51 -0700 |
commit | 476e5e7f8c949251436646dfd155cdd4430c37f2 (patch) | |
tree | 80e997c6bba4b58d4f4b5add12e362af07afb2e4 /lib/block_actor.cpp | |
parent | 121a609ed2cadd50e5e85093e2ac524bdd279d02 (diff) | |
download | sandhi-476e5e7f8c949251436646dfd155cdd4430c37f2.tar.gz sandhi-476e5e7f8c949251436646dfd155cdd4430c37f2.tar.bz2 sandhi-476e5e7f8c949251436646dfd155cdd4430c37f2.zip |
gras: added thread prio support hooks
Diffstat (limited to 'lib/block_actor.cpp')
-rw-r--r-- | lib/block_actor.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/block_actor.cpp b/lib/block_actor.cpp index 5365724..3ce7742 100644 --- a/lib/block_actor.cpp +++ b/lib/block_actor.cpp @@ -2,57 +2,11 @@ #include <gras/thread_pool.hpp> #include <gras_impl/block_actor.hpp> -#include <boost/thread/thread.hpp> #include <Theron/Framework.h> #include <stdexcept> using namespace gras; -ThreadPoolConfig::ThreadPoolConfig(void) -{ - thread_count = boost::thread::hardware_concurrency(); - thread_count = std::max(size_t(2), thread_count); - node_mask = 0; - processor_mask = 0xffffffff; - yield_strategy = "BLOCKING"; - - //environment variable override - const char * gras_yield = getenv("GRAS_YIELD"); - if (gras_yield != NULL) yield_strategy = gras_yield; -} - -/*********************************************************************** - * Thread pool implementation - **********************************************************************/ -ThreadPool::ThreadPool(void) -{ - //NOP -} - -ThreadPool::ThreadPool(boost::weak_ptr<Theron::Framework> p): - boost::shared_ptr<Theron::Framework>(p.lock()) -{ - //NOP -} - -ThreadPool::ThreadPool(const ThreadPoolConfig &config) -{ - Theron::Framework::Parameters params( - config.thread_count, - config.node_mask, - config.processor_mask - ); - - if (config.yield_strategy.empty()) params.mYieldStrategy = Theron::YIELD_STRATEGY_STRONG; - else if (config.yield_strategy == "BLOCKING") params.mYieldStrategy = Theron::YIELD_STRATEGY_BLOCKING; - else if (config.yield_strategy == "POLITE") params.mYieldStrategy = Theron::YIELD_STRATEGY_POLITE; - else if (config.yield_strategy == "STRONG") params.mYieldStrategy = Theron::YIELD_STRATEGY_STRONG; - else if (config.yield_strategy == "AGGRESSIVE") params.mYieldStrategy = Theron::YIELD_STRATEGY_AGGRESSIVE; - else throw std::runtime_error("gras::ThreadPoolConfig yield_strategy unknown: " + config.yield_strategy); - - this->reset(new Theron::Framework(Theron::Framework::Parameters(params))); -} - /*********************************************************************** * Active framework implementation **********************************************************************/ |