You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/06/17 14:54:13 UTC

[GitHub] [incubator-nuttx] v01d commented on pull request #1248: Do not set oneshot zero timer period

v01d commented on pull request #1248:
URL: https://github.com/apache/incubator-nuttx/pull/1248#issuecomment-645424929


   > I'm not sure if this is the correct behavior. Shouldn't we return an error when a given period is not achievable?
   > This is the case where the function argument is out of the supported range, and in this case we should return an error (probably -EINVAL).
   
   This may be another option. And in fact, you could argue that requesting zero timeout is like sleep(0), it should "hang" (in the context of the oneshot timer, not get called). However, when you call e.g. usleep(1) you're not guaranteed to sleep exactly 1us but may be more than that. If one requests a oneshot() timer with a small period but > 0 there's also the chance that the ARR ends up zero due to the timer frequency. In other words, the caller of the oneshot setup call has no way of knowing what is the minimum valid time for the timer. If you return EINVAL there should be a mechanism of requesting the smallest possible valid oneshot() time. 


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

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