--- Begin Message ---
Subject: |
Re: Timestamp race avoidance in do_update() |
Date: |
Thu, 15 Feb 2001 08:39:06 -0500 |
Laine Stump wrote:
> I just patched the WinNT files to use a "kind of" usleep (the WinAPI
> Sleep() function is in milliseconds, so I have to divide by 1000). I
> thought of using select() instead, but that would require #including
> winsock2.h, which might have been ugly.
According to the Linux nanosleep man page, due to the current accuracy of the
system timer, Intel machines only have an accuracy of 10ms and Alpha of 1ms,
anyhow.
> + Sleep(useconds/1000);
I changed this line to
Sleep(useconds/1000 + (useconds%1000 ? 1 : 0));
It more closely matches the Linux definition of nanosleep (sleeping _at least_
X seconds, barring interrupts). Linux usleep didn't specify which direction
error would be in, but I thought this made sense. Besides, it rounds up now,
making it impossible to get zero by accident.
Checked in.
Derek
--
Derek Price CVS Solutions Architect ( http://CVSHome.org )
mailto:address@hidden OpenAvenue ( http://OpenAvenue.com )
--
Where are we going? And what's with this handbasket?
--- End Message ---