<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 13.08.2010 23:14, <a class="moz-txt-link-abbreviated" href="mailto:commits@squeakvm.org">commits@squeakvm.org</a> wrote:
<blockquote cite="mid:E1Ok1a2-0004f5-41@vps2.piumarta.com"
type="cite">
<pre wrap="">
Author: eliot
Date: 2010-08-13 14:14:21 -0700 (Fri, 13 Aug 2010)
New Revision: 2253
Modified:
branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
Log:
Integrate Henrik Johansen's fix for the nanosleep call in the heartbeat.
Modified: branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c        2010-08-11 18:03:02 UTC (rev 2252)
+++ branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c        2010-08-13 21:14:21 UTC (rev 2253)
@@ -607,6 +607,8 @@
                struct timespec naptime = beatperiod;
                while (nanosleep(&naptime, &naptime) == -1
+                        /* oversleeps can return tv_sec = -1 tv_nsec approx 999999999 */
+                        && naptime.tv_sec >= 0 /* avoid undoc'ed oversleep behaviour */
                        && (naptime.tv_sec > 0 || naptime.tv_nsec > MINSLEEPNS)) /*repeat*/
                        if (errno != EINTR) {
                                perror("nanosleep");
</pre>
</blockquote>
To be finicky, it's not actually undocumented though, if I
interpreted the man pages correctly :)<br>
<a
href="http://www.opengroup.org/onlinepubs/009695399/functions/nanosleep.html">http://www.opengroup.org/onlinepubs/009695399/functions/nanosleep.html</a><br>
<a
href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man2/nanosleep.2.html">http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man2/nanosleep.2.html</a><br>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family:
Arial,Verdana,Helvetica,sans-serif; font-size: 12px;"><br>
"If the<span class="Apple-converted-space"> </span><tt
class="literal" style="font-family: 'courier
new',courier,monospace;">rmtp</tt><span
class="Apple-converted-space"> </span>argument is non-NULL,
the<i class="replaceable"><tt style="font-family: 'courier
new',courier,monospace;">timespec</tt></i><span
class="Apple-converted-space"> </span>structure referenced by
it is updated to contain the amount of time remaining in the
interval (the requested time minus the time actually slept). "<br>
<br>
Since it also specifies that the valid range for tv_nsec is 0 -
999999999, a negative value for tv_sec is the only valid option
when it has overslept before being interrupted.<br>
<br>
Cheers,<br>
Henry<br>
</span></span>
</body>
</html>