Replies: 1 comment
-
Hi @rookybird The main difference between both approaches, using listener callback or using waitsets, is where the incoming data reception is processed as it is explained in Fast DDS documentation. Listener callbacks are executed in the reception thread, blocking any other reception until the current sample is processed. Using waitsets, the data reception and processing it is done in the user application thread where the waitset operation have been called. You might find interesting the concurrency and multithreading section in Fast DDS documentation. Consequently, if you want to receive from multiple subscriptions without blocking behavior, you will need to properly design your application having into account the previous information. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
Both data reader listener and waitset can be used for new data reception.
From my understanding, waitset waits until one of the attached conditions becomes true or the user-defined wait time expires.
For data reader listener, on_data_available callback function will be triggered when new data arrives.
I am wondering the performance difference between these two methods on data reception.
On normal case: for a single topic, new data arrives every 100ms, and the user data processing time is short (let's say 1ms). I tested both methods function well.
On extreme case: for a single topic, new data arrives every 100ms, but the user data processing time is long (eg. 205ms), will waitset and reader listener both lose the packet that is supposed to come at 200ms?
Another question is regarding multiple topics subscription.
For instance, I create a participant to subscribe three topics (topic1, topic2, and topic3).
Data reader listener: I will use three data reader listeners for these three topics respectively. I will handle the data in the callback. If my processing time for one of the topic is longer the frequency of the topic (same as the extreme case above), will it block the callback function of the other two topics?
Waitset: If I create one waitset and attach three reader conditions to it, while I am processing on one of it, will it block the reception of the other two topics? If it blocks the other two, should I create three waitsets for three topics?
Beta Was this translation helpful? Give feedback.
All reactions