Skip to content

Commit fa95b39

Browse files
clalancetteHarunTeper
authored andcommitted
Fix warnings on Windows. (ros2#2692)
For reasons I admit I do not understand, the deprecation warnings for StaticSingleThreadedExecutor on Windows happen when we construct a shared_ptr for it in the tests. If we construct a regular object, then it is fine. Luckily this test does not require a shared_ptr, so just make it a regular object here, which rixes the warning. While we are in here, make all of the tests camel case to be consistent. Signed-off-by: Chris Lalancette <[email protected]>
1 parent d810987 commit fa95b39

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

rclcpp/test/rclcpp/executors/test_executors.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,18 +881,24 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
881881
}
882882

883883
// Create an executor
884-
auto executor = std::make_shared<ExecutorType>();
885-
executor->add_node(this->node);
884+
ExecutorType executor;
885+
executor.add_node(this->node);
886886

887887
// Start spinning
888888
auto executor_thread = std::thread(
889+
<<<<<<< HEAD
889890
[executor]() {
890891
executor->spin();
891892
>>>>>>> e9b10042 (fix(Executor): Fix segfault if callback group is deleted during rmw_wait (#2683))
893+
=======
894+
[&executor]() {
895+
executor.spin();
896+
>>>>>>> 3310f9ea (Fix warnings on Windows. (#2692))
892897
});
893898

894899
// As the problem is a race, we do this multiple times,
895900
// to raise our chances of hitting the problem
901+
<<<<<<< HEAD
896902
<<<<<<< HEAD
897903
for (size_t i = 0; i < 10; i++) {
898904
auto cg = this->node->create_callback_group(
@@ -901,6 +907,11 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
901907
for(size_t i = 0; i < 10; i++) {
902908
auto cg = this->node->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
903909
>>>>>>> e9b10042 (fix(Executor): Fix segfault if callback group is deleted during rmw_wait (#2683))
910+
=======
911+
for (size_t i = 0; i < 10; i++) {
912+
auto cg = this->node->create_callback_group(
913+
rclcpp::CallbackGroupType::MutuallyExclusive);
914+
>>>>>>> 3310f9ea (Fix warnings on Windows. (#2692))
904915
auto timer = this->node->create_timer(1s, [] {}, cg);
905916
// sleep a bit, so that the spin thread can pick up the callback group
906917
// and add it to the executor
@@ -911,10 +922,14 @@ TYPED_TEST(TestExecutors, testRaceDropCallbackGroupFromSecondThread)
911922
// If the executor has a race, we will experience a segfault at this point.
912923
}
913924

925+
<<<<<<< HEAD
914926
<<<<<<< HEAD
915927
executor.cancel();
916928
=======
917929
executor->cancel();
918930
>>>>>>> e9b10042 (fix(Executor): Fix segfault if callback group is deleted during rmw_wait (#2683))
931+
=======
932+
executor.cancel();
933+
>>>>>>> 3310f9ea (Fix warnings on Windows. (#2692))
919934
executor_thread.join();
920935
}

0 commit comments

Comments
 (0)