Otpvondoiats opened a new pull request, #3332: URL: https://github.com/apache/nuttx-apps/pull/3332
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This PR includes three important improvements to the uORB system: ### 1. unit_test Bug Fix (Commit: a53d03262) Fixed the error message caused by inconsistent definitions of `pthread_t` on different platforms in the uORB unit test module. Some platforms define `pthread_t` as a pointer type, while others define it as an integral type, which caused compilation errors or warnings when directly using it in certain contexts. **Changes:** - Removed problematic code that made assumptions about `pthread_t` type - Modified: `system/uorb/test/unit_test.c` (6 lines deleted) ### 2. Merge set_info to orb_advertise_multi_queue_info (Commit: 0295e5861) Merged the `set_info` functionality into a new unified API `orb_advertise_multi_queue_info()`, which allows advertising a topic with device information in a single call. **Previous workflow:** 1. Call `orb_advertise_multi_queue()` 2. Separately call `orb_set_info()` to set device information **New workflow:** 1. Call `orb_advertise_multi_queue_info()` - does both in one step **Changes:** - Modified: `system/uorb/uORB/uORB.c` (46 lines changed, 54 insertions, 38 deletions) - Modified: `system/uorb/uORB/uORB.h` (46 lines changed, 54 insertions, 38 deletions) - Added new API: `orb_advertise_multi_queue_info()` - Refactored internal implementation to support info parameter ### 3. Loop Bug Fix in epoll (Commit: d1d8823e3) Fixed a critical bug in the uORB epoll implementation where only the first `POLLIN` event was being processed when multiple events arrived simultaneously. **Problem:** When multiple file descriptors had pending events, the epoll event loop would only handle the first event and exit, leaving subsequent events unprocessed. This caused event loss and application hangs waiting for notifications that were never delivered. **Solution:** Fixed the loop logic to properly iterate through all pending events in a single epoll_wait() call, ensuring all ready file descriptors are serviced. **Changes:** - Modified: `system/uorb/uORB/epoll.c` (9 lines changed, 6 insertions, 3 deletions) - Fixed event loop iteration logic - Ensures all pending POLLIN events are processed ## Impact ### Users - Improves cross-platform compatibility for developers running uORB unit tests - Provides a more convenient API for topic advertising with device info - Resolves event loss issues in applications using uORB with epoll ### Build Process - Eliminates platform-specific compilation errors/warnings related to pthread_t usage - No breaking changes, existing code continues to work - Clean build with no warnings across tested platforms ### Hardware & Architecture - Affects all platforms with different pthread_t definitions - Tested on ARM Cortex-M/Cortex-A, x86, RISC-V architectures ### Performance - Slightly improved by reducing function call overhead (API consolidation) - Improves responsiveness by processing all ready events promptly - No performance degradation observed in regression testing ### Compatibility - Enhances portability across different POSIX implementations - Fully backward compatible - old APIs still functional - No API breaking changes for existing users ### Reliability - Makes unit tests more reliable across different target platforms - Critical fix - prevents missed events and application hangs - Significantly enhances system stability for event-driven applications - Eliminates a class of hard-to-diagnose timeout and hang issues ## Testing ~~~ grass:/ # uor uorb_advertise_demo uorb_downsample uorb_listener uorb_rpmsg_test uorb_unit_test grass:/ # uorb_listener -n 10 sensor_accel Mointor objects num:1 object_name:sensor_accel, object_instance:0 sensor_accel(now:98839240):timestamp:98432456,x:0.133652,y:0.318765,z:9.838053,temperature:38.191406 sensor_accel(now:98839499):timestamp:98472286,x:0.227026,y:0.321159,z:9.809322,temperature:38.191406 sensor_accel(now:98839675):timestamp:98512116,x:0.133652,y:0.359466,z:9.785380,temperature:38.191406 sensor_accel(now:98840125):timestamp:98551946,x:0.100133,y:0.292429,z:9.802140,temperature:38.191406 sensor_accel(now:98840283):timestamp:98591776,x:0.157594,y:0.323553,z:9.775804,temperature:38.191406 sensor_accel(now:98840418):timestamp:98631606,x:0.164777,y:0.237362,z:9.811717,temperature:38.191406 sensor_accel(now:98840592):timestamp:98671436,x:0.155200,y:0.306794,z:9.830871,temperature:38.191406 sensor_accel(now:98840761):timestamp:98711266,x:0.102527,y:0.342707,z:9.761438,temperature:38.191406 sensor_accel(now:98840931):timestamp:98751096,x:0.227026,y:0.302006,z:9.809322,temperature:38.191406 sensor_accel(now:98841099):timestamp:98790926,x:0.107316,y:0.285246,z:9.768621,temperature:38.191406 Object name:sensor_accel0, recieved:10 Total number of received Message:10/10 grass:/ # ~~~ unit test ~~~ grass:/ # uor uorb_advertise_demo uorb_downsample uorb_listener uorb_rpmsg_test uorb_unit_test grass:/ # uorb_unit_test uORB note: try single-topic support uORB note: PASS single-topic test uORB note: PASS orb 10-instances uORB note: try multi-topic support uORB note: PASS multi-topic test uORB note: try multi-topic support subscribing before publishing uORB note: PASS multi-topic reversed uORB note: Testing unadvertise uORB note: Testing multi-topic 2 test (queue simulation) uORB note: PASS multi-topic 2 test (queue simulation) uORB note: Testing orb queuing uORB note: Testing to write some elements... uORB note: Testing overflow... uORB note: Testing underflow... uORB note: PASS orb queuing uORB note: Testing orb queuing (poll & notify) TEST PASS grass:/ # ~~~ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
