[Nut-upsdev] patch: Replace many usleep and some sleep calls with nanosleep
Arnaud Quette
aquette.dev at gmail.com
Mon Oct 3 17:42:34 UTC 2011
Hi Regid,
2011/10/3 Stuart D Gathman <stuart at bmsi.com>:
> 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.
sorry, but Stuart is right.
I should have replied to your other (well, this one) report on this.
Using AC_REPLACE_FUNCS(... usleep ...) in configure.in and providing a
common/usleep.c->usleep() replacement implementation, in case the
system doesn't provide it, is a better way to go. At least for now.
That way, we avoid regression, while supporting systems that do not
provide usleep.
thanks for your appreciated work Regid!
cheers,
Arnaud
More information about the Nut-upsdev
mailing list