linguini1 commented on PR #17222:
URL: https://github.com/apache/nuttx/pull/17222#issuecomment-3426807904

   > Sleep and wakeup sometimes should be in pair in terms of syncronization
   > 
   > For example task1 can not move on because some condition is not met and 
choose to sleep for a while in the simplest case, but before timeout task2 
which has lower priority than task1 met the condition, then it can wakeup task1 
to let task1 preempt it
   > 
   > 
   > sleep/wakeup is simpler and lighter than mutex, semaphore or event in  
this case
   
   But this isn't what sleeping is for? If you want to wait for a condition, 
you block on a semaphore/mutex, not sleep (unless it's some hardware pulling 
condition that requires sleeping).
   
   I personally don't support the addition of the wakeup function since now all 
the `up_delay` have been replaced with this new implementation, and `up_delay` 
would never return before the timeout. We're changing the behavior all over the 
code. This is a sleep function, not for waiting on a condition, just sleeping. 
I don't see a use case this is needed either, just use a semaphore.
   


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

Reply via email to