Skip to content

Commit

Permalink
change executor impls. to pass memory strategy to parent constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackie Kay committed Jul 20, 2015
1 parent 370cdcc commit bc89a4c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Executor
public:
RCLCPP_MAKE_SHARED_DEFINITIONS(Executor);

Executor(memory_strategy::MemoryStrategy::SharedPtr ms =
explicit Executor(memory_strategy::MemoryStrategy::SharedPtr ms =
memory_strategy::create_default_strategy())
: interrupt_guard_condition_(rmw_create_guard_condition()),
memory_strategy_(ms)
Expand Down
3 changes: 2 additions & 1 deletion rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class MultiThreadedExecutor : public executor::Executor
public:
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();
if (number_of_threads_ == 0) {
Expand Down
3 changes: 2 additions & 1 deletion rclcpp/include/rclcpp/executors/single_threaded_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class SingleThreadedExecutor : public executor::Executor
public:
RCLCPP_MAKE_SHARED_DEFINITIONS(SingleThreadedExecutor);

SingleThreadedExecutor() {}
SingleThreadedExecutor(memory_strategy::MemoryStrategy::SharedPtr ms =
memory_strategy::create_default_strategy()) : executor::Executor(ms) { }

virtual ~SingleThreadedExecutor() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class StaticMemoryStrategy : public memory_strategy::MemoryStrategy

void ** borrow_handles(HandleType type, size_t number_of_handles)
{
std::cout << "static borrow handles" << std::endl;
switch (type) {
case HandleType::subscriber_handle:
if (number_of_handles > max_subscribers_) {
Expand Down

0 comments on commit bc89a4c

Please sign in to comment.