[PATCH] Multiple timer issues + new [PATCH]

Irányossy Knoblauch Artúr ikartur@gmail.com
Thu Feb 18 23:39:00 GMT 2016


On Thu, Feb 18, 2016 at 12:28 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:

> Would you mind terribly to send a copyright assignment per
> https://cygwin.com/contrib.html?  If you send it as PDF by mail it takes
> usually just a few days to be countersigned.

OK, I will try my best. :-)

> I would apply patch 2 immediately, but as far as I can see it relies
> on patch 1.  Without patch 1, exchanging gtod with ntod will not change
> anything since it's still a non-monotonic timer.  Or am I missing
> something?

Exchanging 'gtod' with 'ntod' in select() could solve the issue if
'ntod' had its msecs() method implemented. So you are correct, the
patches are dependent on each other.

The important thing to note is that gtod (type hires_ms) is getting
its time using GetSystemTimeAsFileTime(), which is the system time
(UTC). Thus, the time returned by gtod is not adequate for measuring
time intervals, because a system time adjustment could interfere with
the measurement.

The ntod timer (type hires_ns), however, is getting its time value
from QueryPerformanceCounter(), which, according to the MSDN
documentation, will provide a "time stamp that can be used for
time-interval measurements" -- that is just what the doctor ordered.

I could not find any information regarding what the names 'gtod' and
'ntod' are supposed to mean, and their type names, hires_ms and
hires_ns, respectively, aren't conveying that 'ntod' is monotonic
while 'gtod' isn't.

Also, as I have been writing this mail, I have noticed that there is
still a data race left in the prime() function, so I have made a patch
for that, too.

Best Regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Fix-data-race-during-lazy-initialization.patch
Type: text/x-patch
Size: 2379 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20160218/b0b95fa0/attachment.bin>

More information about the Cygwin-patches mailing list