You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see Executor::spin_until_future_complete(), but not rclcpp::spin_until_future_complete(). How is it meant to be used?
Using it in the main thread outside of an executor looks fine.
future=client.call(req)
executor.spin_until_future_complete(future)
iffuture.get() isnotNone:
print('Doing something with result %r', future.get())
Used in a callback done by a single threaded executor would be ok, except from the perspective of the main thread a spin_once() call might handle multiple callbacks. From a multi threaded executor it would cause rcl_wait() to be called on the same wait_set in multiple threads.
# main threadwhilerclpy.ok()
# OK, though spin_once may handle more than 1 callback since the callback can spinsingleThreadedExecutor.spin_once()
# Not OK, this will dispatch the callback and call rcl_wait again,# but the callback will also call spin which will call rcl_wait on the# same wait set in another thread. rcl_wait() warns it is not thread safe.# multiThreadedExecutor.spin_once()# ...# Subscriber callbackdeflistener_cb(self, response):
future=self.client.call(req)
# Executor has to be given to this object somehowself.executor.spin_until_future_complete(future)
iffuture.get() isnotNone:
print('Doing something with result %r', future.get())
Activity
sloretz commentedon Oct 19, 2017
I see
Executor::spin_until_future_complete(), but notrclcpp::spin_until_future_complete(). How is it meant to be used?Using it in the main thread outside of an executor looks fine.
Used in a callback done by a single threaded executor would be ok, except from the perspective of the main thread a
spin_once()call might handle multiple callbacks. From a multi threaded executor it would causercl_wait()to be called on the same wait_set in multiple threads.sloretz commentedon Oct 24, 2017
Thoughts/notes regarding Future objects:
client.call(req)could returns a future and keep a list of tasks. Executor would pull those tasks off the client objectsloretz commentedon Mar 22, 2018
Connected to #170 because that implements almost everything in the description. #58 (asyncronous wait_for_service) will carry on on it's own.
Merge pull request ros2#123 from Carter12s/add-max-times-to-ci-jobs