Subject: Re: pkg/24217: Wrong use of usleep() in wget 1.9.1 pkg
To: David Laight <david@l8s.co.uk>
From: Jesper Louis Andersen <jlouis@mongers.org>
List: netbsd-bugs
Date: 01/25/2004 17:14:42
Quoting David Laight (david@l8s.co.uk):

> An alternative is to change the:
> 	usleep(1000000L * timeout);
> to
> 	poll(0, 0, 1000L * timeout);
> 
> Which has the added advantage that isn't allowed to be implemented
> in terms of the alarm timer and SIGALRM.

There is a couple of things the wget folk suggested. First, they have
rewritten the part to use nanosleep() in their CVS-version. I noted to 
them, that this call too can return EINVAL but I am not sure if it 
has impact. To me it seems like they will face exactly the same problem,
but I may be wrong.

The primary reason they are using usleep() is that they want to be able
to sleep for fractions of a second. My patch does not solve that 
problem sadly. However, what David suggested above does };-).

Alternatively another suggestion was to use sleep() and usleep() in
combination, where usleep would be used for the last fraction. 

-- 
j.