[pypy-svn] r41329 - pypy/dist/pypy/tool/build

guido at codespeak.net guido at codespeak.net
Mon Mar 26 12:58:06 CEST 2007


Author: guido
Date: Mon Mar 26 12:58:06 2007
New Revision: 41329

Modified:
   pypy/dist/pypy/tool/build/multibuild.py
Log:
Added MAX_ACTIVE_THREADS switch that controls how many active threads there
can be at max, removed some stupid line of debug code.


Modified: pypy/dist/pypy/tool/build/multibuild.py
==============================================================================
--- pypy/dist/pypy/tool/build/multibuild.py	(original)
+++ pypy/dist/pypy/tool/build/multibuild.py	Mon Mar 26 12:58:06 2007
@@ -9,10 +9,13 @@
 import random
 import os
 import threading
+import time
 from pypy.translator.goal.multibuild import get_options, exe_name_from_options
 from pypy.tool.build import config
 from pypy.tool.build.compile import getrequest, main
 
+MAX_ACTIVE_THREADS = 5
+
 class ConfigWrapper(object):
     def __init__(self, orgconfig):
         self.__dict__.update(orgconfig.__dict__)
@@ -42,7 +45,6 @@
                "didn't configure"
     request, foreground = getrequest(config, sys.argv[3:])
     hasbuilt, message = main(config, request, True)
-    hasbuilt, message = (True, 'foo')
     return hasbuilt and 'successfully built' or 'not built: %s' % (message,)
 
 def wait_until_done():
@@ -84,6 +86,14 @@
         t = threading.Thread(target=build_pypy_with_options,
                              args=(basedir, opts))
         t.start()
+        while 1:
+            # tiny bit of slack to the server
+            time.sleep(1)
+            active = len([t for t in threading.enumerate() if t.isAlive() and
+                          t != threading.currentThread()])
+            if active < MAX_ACTIVE_THREADS:
+                break
+            
     wait_until_done()
     print 'done'
 



More information about the Pypy-commit mailing list