Skip to content

Commit

Permalink
Merge pull request #186 from ros2/remove_sleep
Browse files Browse the repository at this point in the history
remove excess sleep
  • Loading branch information
gerkey committed Dec 18, 2015
2 parents 300c7ca + a7a6111 commit 496c3e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class MultiThreadedExecutor : public executor::Executor

std::mutex wait_mutex_;
size_t number_of_threads_;
std::unordered_map<std::thread::id, size_t> thread_number_by_thread_id_;
};

} // namespace multi_threaded_executor
Expand Down
4 changes: 1 addition & 3 deletions rclcpp/src/rclcpp/executors/multi_threaded_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ MultiThreadedExecutor::spin()
{
std::lock_guard<std::mutex> wait_lock(wait_mutex_);
for (; thread_id < number_of_threads_ - 1; ++thread_id) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
auto func = std::bind(&MultiThreadedExecutor::run, this, thread_id);
threads.emplace_back(func);
}
Expand All @@ -65,9 +64,8 @@ MultiThreadedExecutor::get_number_of_threads()
}

void
MultiThreadedExecutor::run(size_t this_thread_number)
MultiThreadedExecutor::run(size_t)
{
thread_number_by_thread_id_[std::this_thread::get_id()] = this_thread_number;
while (rclcpp::utilities::ok() && spinning.load()) {
executor::AnyExecutable::SharedPtr any_exec;
{
Expand Down

0 comments on commit 496c3e1

Please sign in to comment.