GUIDINGLI opened a new pull request, #16283:
URL: https://github.com/apache/nuttx/pull/16283

   ## Summary
   
   struct work_s
   {
     union
     {
       struct
       {
         struct dq_entry_s dq;      /* Implements a double linked list */
         clock_t qtime;             /* Time work queued */
       } s;
       struct wdog_s timer;         /* Delay expiry timer */
       struct wdog_period_s ptimer; /* Period expiry timer */
     } u;
     worker_t  worker;              /* Work callback */
     FAR void *arg;                 /* Callback argument */
     FAR struct kwork_wqueue_s *wq; /* Work queue */
   };
   
   work_cancel() should determine whether the current work is in the timer or 
has already entered the queue.
   This judgment is indispensable because the structure is a union. Whether it 
is interpreted as a timer or as a dq needs to be determined.
   
   But this judgment seriously depends on the order of struct wdog_s and struct 
dq_entry_s, once someone change the order of any, there is a bug. So we decide 
remove the union, to improve the robustness.
   
   ## Impact
   
   For the work_s structure size will grow bigger, then we will provide a 
another optimization patch
   https://github.com/apache/nuttx/pull/16231
   
   
   ## Testing
   
   Ostest in sim:nsh
   
   
   


-- 
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