Skip to content

Commit 0162861

Browse files
fujitatomoyaJanosch Machowinski
andauthored
remove cancel_clock_executor_promise_. (#2797)
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com> Co-authored-by: Janosch Machowinski <J.Machowinski@cellumation.com>
1 parent 6040228 commit 0162861

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

rclcpp/src/rclcpp/time_source.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ class TimeSource::NodeState final
346346
std::mutex clock_sub_lock_;
347347
rclcpp::CallbackGroup::SharedPtr clock_callback_group_;
348348
rclcpp::executors::SingleThreadedExecutor::SharedPtr clock_executor_;
349-
std::promise<void> cancel_clock_executor_promise_;
350349

351350
// The clock callback itself
352351
void clock_cb(std::shared_ptr<const rosgraph_msgs::msg::Clock> msg)
@@ -392,12 +391,10 @@ class TimeSource::NodeState final
392391
clock_executor_ =
393392
std::make_shared<rclcpp::executors::SingleThreadedExecutor>(exec_options);
394393
if (!clock_executor_thread_.joinable()) {
395-
cancel_clock_executor_promise_ = std::promise<void>{};
396394
clock_executor_thread_ = std::thread(
397395
[this]() {
398-
auto future = cancel_clock_executor_promise_.get_future();
399396
clock_executor_->add_callback_group(clock_callback_group_, node_base_);
400-
clock_executor_->spin_until_future_complete(future);
397+
clock_executor_->spin();
401398
}
402399
);
403400
}
@@ -429,7 +426,6 @@ class TimeSource::NodeState final
429426
{
430427
std::lock_guard<std::mutex> guard(clock_sub_lock_);
431428
if (clock_executor_thread_.joinable()) {
432-
cancel_clock_executor_promise_.set_value();
433429
clock_executor_->cancel();
434430
clock_executor_thread_.join();
435431
clock_executor_->remove_callback_group(clock_callback_group_);

0 commit comments

Comments
 (0)