[pypy-commit] stmgc default: Give different seeds to each thread.

arigo noreply at buildbot.pypy.org
Mon Jun 24 17:17:32 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r266:4acf3f474301
Date: 2013-06-24 17:17 +0200
http://bitbucket.org/pypy/stmgc/changeset/4acf3f474301/

Log:	Give different seeds to each thread.

diff --git a/c4/demo_random.c b/c4/demo_random.c
--- a/c4/demo_random.c
+++ b/c4/demo_random.c
@@ -242,7 +242,7 @@
 void setup_thread()
 {
     int i;
-    td.thread_seed = default_seed;
+    td.thread_seed = default_seed++;
     td.steps_left = STEPS_PER_THREAD;
     td.interruptible = 0;
     
@@ -479,7 +479,8 @@
     
     // seed changes daily
     // a bit pointless for now..
-    default_seed = time(NULL) / 3600 / 24;
+    default_seed = time(NULL);
+    default_seed -= (default_seed % (3600 * 24));
     
     for (i = 0; i < SHARED_ROOTS; i++) {
         if (i % 3 == 0) {


More information about the pypy-commit mailing list