JianyuWang0623 opened a new pull request, #3064:
URL: https://github.com/apache/nuttx-apps/pull/3064

   ## Summary
   Configured loop function with `UORB_LOOP_MAX_EVENTS`, added eventfd for loop 
exit notification, fixed orb_loop_s undeclared error, and included API for 
sending loop exit event. We can exit the loop by calling the new API 
`orb_loop_exit_async()`.
   1. Using `UORB_LOOP_MAX_EVENTS` to config loop function
   2. Add eventfd to notify loop exit
   3. Fix orb_loop_s undeclared error
   4. Add API for sending loop exit event
   
   ## Impact
   - system/uorb/uORB: Add new API `orb_loop_exit_async()`
   ```diff
   
+/****************************************************************************
   + * Name: orb_loop_exit_async
   + *
   + * Description:
   + *   Send exit event to the current loop(not wait).
   + *
   + * Input Parameters:
   + *   loop   orb loop contains multiple handles.
   + *
   + * Returned Value:
   + *   Zero (OK) on success; a -1 (ERROR) or negated errno value on failure.
   + 
****************************************************************************/
   +
   +int orb_loop_exit_async(FAR struct orb_loop_s *loop);
   ```
   
   ## Testing
   1. Selftest
       - The main thread
       ```
         orb_loop_init(&mLoop, orb_loop_type_e::ORB_EPOLL_TYPE);
       
         // ... ...
       
         if (orb_loop_exit_async(&mLoop) == 0) {
             mThread.join();
         }
       ```
   
       - The uORB loop thread
       ```
         mThread= std::thread([=]() {
             if (orb_loop_run(&mLoop) < 0) {
                 // error ...
             }
       
             orb_loop_deinit(&mLoop); 
         });
       ```
   2. CI
   


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to