[Vm-dev] [commit] r2253 - Integrate Henrik Johansen's fix for the nanosleep call in the heartbeat.

commits at squeakvm.org commits at squeakvm.org
Fri Aug 13 21:14:22 UTC 2010


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");



More information about the Vm-dev mailing list