According to Geoff Hutchison:
> At 12:08 PM +0000 3/23/01, Malcolm Austen wrote:
> >of >10,000 pages to be indexed from one server I just can't manage with
> >only integer seconds control.
> >
> >Could an alternative be considered please?
> 
> Well, the problem is one of system calls. Right now, we're using 
> sleep() which only takes integers. I would guess the biggest 
> stumbling block to using something else is whether there's a very 
> portable alternative. I can see calls for setitimer() on my Linux 
> box, but I don't know if this is actually part of POSIX or not.

My vote would be to stick with server_wait_time, and make it a Double
rather than integer value, where the handling of fractional values would
be system-dependent.

Linux has nanosleep(), which conforms to POSIX.1b (formerly POSIX.4),
and uses a structure that defines both seconds and nanoseconds to sleep.
It also has usleep(), which conforms to BSD 4.3, and accepts a single
unsigned long int specifying microseconds to sleep (this would work as
long as server_wait_time < 4280 or thereabouts).  Both have a granularity
of 1/100 s on Linux x86, which should be adequate for this purpose.

To be complete, we should have configure test for both, and probably use
nanosleep() by preference, if available.  To be really thorough, I suppose
we could test for setitimer() on systems that have neither nanosleep()
nor usleep(), which might help on some non-POSIX.1b conforming SysVr4
systems, but this would require signal handling and would get a bit messy.
I suspect Linux implements both nanosleep() and usleep() library functions
using setitimer() and sigaction() systems calls.  It's probably a safe
bet that any system that has setitimer() will also have nanosleep()
or usleep().  (Someone correct me if I'm wrong!)  Indeed, if recent
BSD systems have nanosleep(), we may need to implement fractional
server_wait_time values using only that, and not bother with usleep().

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to