Keep service around until client exits (#48)

* Keep service around until client exits

* use ignore_signal return handler
This commit is contained in:
Jackie Kay 2016-05-03 15:55:55 -07:00
parent 2c9320f5b0
commit 2811eb1312
2 changed files with 7 additions and 2 deletions

View file

@ -113,8 +113,6 @@ int main(int argc, char ** argv)
}
});
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
// Initialize a response.
example_interfaces__srv__AddTwoInts_Response service_response;
example_interfaces__srv__AddTwoInts_Response__init(&service_response);
@ -149,6 +147,10 @@ int main(int argc, char ** argv)
return -1;
}
// Our scope exits should take care of fini for everything
// stick around until launch gives us a signal to exit
while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
return main_ret;
}

View file

@ -1,6 +1,7 @@
# generated from rcl/test/test_two_executables.py.in
from launch import LaunchDescriptor
from launch.exit_handler import ignore_signal_exit_handler
from launch.exit_handler import primary_exit_handler
from launch.launcher import DefaultLauncher
@ -11,11 +12,13 @@ def @TEST_NAME@():
ld.add_process(
cmd=['@TEST_EXECUTABLE1@'],
name='@TEST_EXECUTABLE1_NAME@',
exit_handler=ignore_signal_exit_handler,
)
ld.add_process(
cmd=['@TEST_EXECUTABLE2@', '@TEST_EXECUTABLE1_NAME@'],
name='@TEST_EXECUTABLE2_NAME@',
exit_handler=primary_exit_handler,
)
launcher = DefaultLauncher()