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

   
   ## Summary
   
   drivers: Avoid causing a busy loop in the program due to context switching 
induced by sem_post.
   
   examples:
   There are two threads involved: thread A with a priority of 100 and thread B 
with a priority of 101. Here's how they interact:
   
   When thread A releases a semaphore, thread B is scheduled to execute some 
code and may reacquire the semaphore. If no other tasks are ready, thread A 
will be scheduled to run.
   This continuous process can lead to a busy loop.
   
   ```
   errcode:
   while (nxsem_get_value(&priv->wait, &semcount) >= 0 &&  semcount <= 0)       
                                                       
     {                                                 
       nxsem_post(&priv->wait);     
     }
   ```
   
   ## Impact
   
   bug fix
   
   ## Testing
   
   localtest


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