Skip to content

Commit

Permalink
Initilialize tbb task scheduler correctly. Thanks @oxidase!
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarex authored and Patrick Niklaus committed Oct 19, 2016
1 parent 983ad35 commit 769485c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/extractor/extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ transformTurnLaneMapIntoArrays(const guidance::LaneDescriptionMap &turn_lane_map
*/
int Extractor::run(ScriptingEnvironment &scripting_environment)
{
{
util::LogPolicy::GetInstance().Unmute();
TIMER_START(extracting);
util::LogPolicy::GetInstance().Unmute();
TIMER_START(extracting);

const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
const auto number_of_threads =
std::min(recommended_num_threads, config.requested_num_threads);
tbb::task_scheduler_init init(number_of_threads);
const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
const auto number_of_threads =
std::min(recommended_num_threads, config.requested_num_threads);
tbb::task_scheduler_init init(number_of_threads);

{
util::SimpleLogger().Write() << "Input file: " << config.input_path.filename().string();
if (!config.profile_path.empty())
{
Expand Down
5 changes: 5 additions & 0 deletions unit_tests/util/static_rtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#include <utility>
#include <vector>

#include <tbb/task_scheduler_init.h>

// explicit TBB scheduler init to register resources cleanup at exit
tbb::task_scheduler_init init(2);

BOOST_AUTO_TEST_SUITE(static_rtree)

using namespace osrm;
Expand Down

0 comments on commit 769485c

Please sign in to comment.