This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit dddbb62e26048a1b3394dcec632a4ab94abaf85a
Author: likun17 <[email protected]>
AuthorDate: Tue Jan 14 12:15:02 2025 +0800

    system/uorb/listener: Report flush timeout as failure.
    
    listener_flush_topic() keeps a per-topic result that is printed as
    success when it is 0. A topic whose flush() call succeeded also leaves
    the result at 0, so when the FLUSH_COMPLETE event never arrives and the
    poll times out, the topic is still reported as flushed successfully.
    
    Mark the topic as pending after a successful flush() call and clear
    the result only when SENSOR_EVENT_FLUSH_COMPLETE is received.
    
    Signed-off-by: likun17 <[email protected]>
---
 system/uorb/listener.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/system/uorb/listener.c b/system/uorb/listener.c
index 8df5e31f6..a5a462567 100644
--- a/system/uorb/listener.c
+++ b/system/uorb/listener.c
@@ -636,6 +636,9 @@ static void listener_flush_topic(FAR const struct 
listen_list_s *objlist,
         }
       else
         {
+          /* Set to non-zero value to wait for flush event */
+
+          result[i] = 1;
           nb_flush++;
         }
 
@@ -659,6 +662,7 @@ static void listener_flush_topic(FAR const struct 
listen_list_s *objlist,
                   else if (events & SENSOR_EVENT_FLUSH_COMPLETE)
                     {
                       nb_flush--;
+                      result[i] = 0;
                     }
                 }
 

Reply via email to