Skip to content

Commit

Permalink
Merge pull request #113 from ros2/spin_until_future_complete
Browse files Browse the repository at this point in the history
Pass timeout to spin_until_future_complete
  • Loading branch information
jacquelinekay committed Sep 16, 2015
2 parents 5f57366 + 80658c1 commit 6f07517
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rclcpp/include/rclcpp/rclcpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ void spin(Node::SharedPtr node_ptr)
executor.spin();
}

template<typename FutureT>
template<typename FutureT, typename TimeT = std::milli>
rclcpp::executors::FutureReturnCode
spin_until_future_complete(
Node::SharedPtr node_ptr, std::shared_future<FutureT> & future)
Node::SharedPtr node_ptr, std::shared_future<FutureT> & future,
std::chrono::duration<int64_t, TimeT> timeout = std::chrono::duration<int64_t, TimeT>(-1))
{
rclcpp::executors::SingleThreadedExecutor executor;
return rclcpp::executors::spin_node_until_future_complete<FutureT>(
executor, node_ptr, future);
executor, node_ptr, future, timeout);
}

} /* namespace rclcpp */
Expand Down

0 comments on commit 6f07517

Please sign in to comment.