[pypy-commit] stmgc queue: Ah, this loop should never run more than once even now (re-add asserts)

arigo noreply at buildbot.pypy.org
Thu Jun 18 11:42:40 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: queue
Changeset: r1858:7592a0f11ac2
Date: 2015-06-18 11:43 +0200
http://bitbucket.org/pypy/stmgc/changeset/7592a0f11ac2/

Log:	Ah, this loop should never run more than once even now (re-add
	asserts)

diff --git a/c8/stm/sync.c b/c8/stm/sync.c
--- a/c8/stm/sync.c
+++ b/c8/stm/sync.c
@@ -119,11 +119,13 @@
     long integral_part = (long)incr;
     t->tv_sec += integral_part;
     incr -= integral_part;
+    assert(incr >= 0.0 && incr <= 1.0);
 
     long nsec = t->tv_nsec + (long)(incr * 1000000000.0);
-    while (nsec >= 1000000000) {
+    if (nsec >= 1000000000) {
         t->tv_sec += 1;
         nsec -= 1000000000;
+        assert(nsec < 1000000000);
     }
     t->tv_nsec = nsec;
 }


More information about the pypy-commit mailing list