0

program is now completely single threaded/processed with -p1

This commit is contained in:
Andrew Brown
2010-09-23 00:08:20 -04:00
parent c53070304f
commit b64ea5ad23

View File

@@ -221,7 +221,10 @@ class QuadtreeGen(object):
self._decrease_depth() self._decrease_depth()
# Create a pool # Create a pool
pool = multiprocessing.Pool(processes=procs) if procs == 1:
pool = FakePool()
else:
pool = multiprocessing.Pool(processes=procs)
# Render the highest level of tiles from the chunks # Render the highest level of tiles from the chunks
print "Computing the tile ranges and starting tile processers for inner-most tiles..." print "Computing the tile ranges and starting tile processers for inner-most tiles..."
@@ -516,3 +519,20 @@ def render_worldtile(chunks, colstart, colend, rowstart, rowend, path):
with open(hashpath, "wb") as hashout: with open(hashpath, "wb") as hashout:
hashout.write(digest) hashout.write(digest)
class FakeResult(object):
def __init__(self, res):
self.res = res
def get(self):
return self.res
class FakePool(object):
"""A fake pool used to render things in sync. Implements a subset of
multiprocessing.Pool"""
def apply_async(self, func, args=(), kwargs=None):
if not kwargs:
kwargs = {}
result = func(*args, **kwargs)
return FakeResult(result)
def close(self):
pass
def join(self):
pass