actionlib
actionlib copied to clipboard
Avoid waiting in loops
Using strace we recently figured out that Python nodes are waking up quite frequently and usually this is done for, let's say, no reason.
In the action server implementation here we basically just want to ensure that the executeLoop does not block if we terminate the executable. I rewrote that part by using a condition object and the shutdown hooks.
At the same time I removed the terminate_mutex since it's not needed - at least I couldn't see any reason for it.
Waiting for 100ms actually does not mean that your program is sleeping for 100ms (https://github.com/python/cpython/blob/2.7/Lib/threading.py#L350).
@mgrrx
could you check the CI failure? http://build.ros.org/job/Npr__actionlib__ubuntu_focal_amd64/34/testReport/rostest.runner/RosTest/testtest_cpp_simple_client/
rostest.runner.RosTest.testtest_cpp_simple_client has been in some problems in CI, I am not sure what goes wrong but it just does not get succeeded. (sometimes raise exeception, sometimes timeout so the state is still in active state.)
I assume it's unrelated since there are similar failures every now and then
Regarding the test I guess it's the same as in https://github.com/ros/actionlib/pull/156#issuecomment-595713514.