Class MultiThreadedExecutor
Defined in File multi_threaded_executor.hpp
Inheritance Relationships
Base Type
public rclcpp::Executor
(Class Executor)
Class Documentation
-
class MultiThreadedExecutor : public rclcpp::Executor
Public Functions
-
explicit MultiThreadedExecutor(const rclcpp::ExecutorOptions &options = rclcpp::ExecutorOptions(), size_t number_of_threads = 0, bool yield_before_execute = false, std::chrono::nanoseconds timeout = std::chrono::nanoseconds(-1))
Constructor for MultiThreadedExecutor.
For the yield_before_execute option, when true std::this_thread::yield() will be called after acquiring work (as an AnyExecutable) and releasing the spinning lock, but before executing the work. This is useful for reproducing some bugs related to taking work more than once.
- Parameters:
options – common options for all executors
number_of_threads – number of threads to have in the thread pool, the default 0 will use the number of cpu cores found (minimum of 2)
yield_before_execute – if true std::this_thread::yield() is called
timeout – maximum time to wait
-
virtual ~MultiThreadedExecutor()
-
virtual void spin() override
See also
rclcpp::Executor:spin() for more details
- Throws:
std::runtime_error – when spin() called while already spinning
-
size_t get_number_of_threads()
Protected Functions
-
void run(size_t this_thread_number)
-
explicit MultiThreadedExecutor(const rclcpp::ExecutorOptions &options = rclcpp::ExecutorOptions(), size_t number_of_threads = 0, bool yield_before_execute = false, std::chrono::nanoseconds timeout = std::chrono::nanoseconds(-1))