Add argument for thread count to multithreaded executor (#442)
This commit is contained in:
parent
ef17ec6248
commit
fa81d95e33
2 changed files with 6 additions and 3 deletions
|
@ -36,7 +36,8 @@ public:
|
|||
|
||||
RCLCPP_PUBLIC
|
||||
MultiThreadedExecutor(
|
||||
const executor::ExecutorArgs & args = rclcpp::executor::create_default_executor_arguments());
|
||||
const executor::ExecutorArgs & args = rclcpp::executor::create_default_executor_arguments(),
|
||||
size_t number_of_threads = 0);
|
||||
|
||||
RCLCPP_PUBLIC
|
||||
virtual ~MultiThreadedExecutor();
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
|
||||
using rclcpp::executors::MultiThreadedExecutor;
|
||||
|
||||
MultiThreadedExecutor::MultiThreadedExecutor(const rclcpp::executor::ExecutorArgs & args)
|
||||
MultiThreadedExecutor::MultiThreadedExecutor(
|
||||
const rclcpp::executor::ExecutorArgs & args,
|
||||
size_t number_of_threads)
|
||||
: executor::Executor(args)
|
||||
{
|
||||
number_of_threads_ = std::thread::hardware_concurrency();
|
||||
number_of_threads_ = number_of_threads ? number_of_threads : std::thread::hardware_concurrency();
|
||||
if (number_of_threads_ == 0) {
|
||||
number_of_threads_ = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue