0

I looked at AsyncSpinner and want to check if my understanding is correct. Given two callbacks cb1 registered to one subscriber sub1 and cb2 registered to another different subscriber sub2 , the frequency of subscribing to message in sub1 is much higher than that in sub2 . We may have a global callback queue like [cb1, cb1, cb1, cb1, cb2, cb1, cb1, cb1, cb1] . Also, the processing time of cb1 is very long. Does the process still get stuck even if we use AsyncSpinner because ROS prevents a callback registered in one subscriber from being called simultaneously by multiple threads by default. For example, we have 4 threads but 3 threads are idle and waiting for 1 thread to finish execution of cb1 since the next callback available for other threads is still cb1. Thus, the process is still stuck and behaves like single threaded spinning because other threads have to wait while one thread is processing cb1. Is my understanding correct?

1 Answers1

0

As described in this anwer:

An async spinner tries to call available callbacks in the callback queue as fast as the rate allows. If the callback is already in process (by an other thread) the CallResult is TryAgain. This means a new attempt will be started later on.

Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49