change executor impls. to pass memory strategy to parent constructor

This commit is contained in:
Jackie Kay 2015-07-20 10:36:30 -07:00
parent 370cdcc733
commit bc89a4c2f0
4 changed files with 6 additions and 3 deletions

View file

@ -42,7 +42,7 @@ class Executor
public: public:
RCLCPP_MAKE_SHARED_DEFINITIONS(Executor); RCLCPP_MAKE_SHARED_DEFINITIONS(Executor);
Executor(memory_strategy::MemoryStrategy::SharedPtr ms = explicit Executor(memory_strategy::MemoryStrategy::SharedPtr ms =
memory_strategy::create_default_strategy()) memory_strategy::create_default_strategy())
: interrupt_guard_condition_(rmw_create_guard_condition()), : interrupt_guard_condition_(rmw_create_guard_condition()),
memory_strategy_(ms) memory_strategy_(ms)

View file

@ -40,7 +40,8 @@ class MultiThreadedExecutor : public executor::Executor
public: public:
RCLCPP_MAKE_SHARED_DEFINITIONS(MultiThreadedExecutor); RCLCPP_MAKE_SHARED_DEFINITIONS(MultiThreadedExecutor);
MultiThreadedExecutor() MultiThreadedExecutor(memory_strategy::MemoryStrategy::SharedPtr ms =
memory_strategy::create_default_strategy()) : executor::Executor(ms)
{ {
number_of_threads_ = std::thread::hardware_concurrency(); number_of_threads_ = std::thread::hardware_concurrency();
if (number_of_threads_ == 0) { if (number_of_threads_ == 0) {

View file

@ -41,7 +41,8 @@ class SingleThreadedExecutor : public executor::Executor
public: public:
RCLCPP_MAKE_SHARED_DEFINITIONS(SingleThreadedExecutor); RCLCPP_MAKE_SHARED_DEFINITIONS(SingleThreadedExecutor);
SingleThreadedExecutor() {} SingleThreadedExecutor(memory_strategy::MemoryStrategy::SharedPtr ms =
memory_strategy::create_default_strategy()) : executor::Executor(ms) { }
virtual ~SingleThreadedExecutor() {} virtual ~SingleThreadedExecutor() {}

View file

@ -55,6 +55,7 @@ public:
void ** borrow_handles(HandleType type, size_t number_of_handles) void ** borrow_handles(HandleType type, size_t number_of_handles)
{ {
std::cout << "static borrow handles" << std::endl;
switch (type) { switch (type) {
case HandleType::subscriber_handle: case HandleType::subscriber_handle:
if (number_of_handles > max_subscribers_) { if (number_of_handles > max_subscribers_) {