[Nut-upsdev] patch: Replace many usleep and some sleep calls with nanosleep

Stuart D Gathman stuart at bmsi.com
Mon Oct 3 17:24:25 UTC 2011


On 10/03/2011 01:02 PM, Regid Ichira wrote:
> -		usleep(250000);
> +		struct timespec delay = {0, 250e6}; nanosleep(&delay, NULL);
>
Would it be better to define a local version of usleep in terms of
nanosleep?  I suspect the library version already does that, but if the
library version is going away, a local version is much more concise and
readable than calling nanosleep directly.  If there are concerns about
linking, the local version could be, e.g, u_sleep, since all the calls
are getting touched anyway.




More information about the Nut-upsdev mailing list