[pypy-svn] r24049 - pypy/dist/pypy/lib/logic/computation_space
ludal at codespeak.net
ludal at codespeak.net
Tue Mar 7 12:13:58 CET 2006
Author: ludal
Date: Tue Mar 7 12:13:49 2006
New Revision: 24049
Modified:
pypy/dist/pypy/lib/logic/computation_space/computationspace.py
pypy/dist/pypy/lib/logic/computation_space/distributor.py
Log:
(auc,pedronis,ludal)
join threads after the computation
Modified: pypy/dist/pypy/lib/logic/computation_space/computationspace.py
==============================================================================
--- pypy/dist/pypy/lib/logic/computation_space/computationspace.py (original)
+++ pypy/dist/pypy/lib/logic/computation_space/computationspace.py Tue Mar 7 12:13:49 2006
@@ -159,7 +159,6 @@
# try to break ref. cycles and help
# threads terminate
self.status = Forsaken
- self.distributor = None
self.parent = None
self.children = None
self.CHOOSE.bind(True)
@@ -300,9 +299,11 @@
# var.bind(self.dom(var).get_values()[0])
# shut down the distributor
self.CHOOSE.bind(True)
+ self.status = Forsaken
res = []
for var in self.root.val:
res.append(self.dom(var).get_values()[0])
+ self.distributor.join()
return res
def set_distributor(self, dist):
@@ -386,6 +387,7 @@
def dom(self, var):
assert isinstance(var, CsVar)
+ return self.doms.get(var, NoDom)
try:
return self.doms[var]
except KeyError:
Modified: pypy/dist/pypy/lib/logic/computation_space/distributor.py
==============================================================================
--- pypy/dist/pypy/lib/logic/computation_space/distributor.py (original)
+++ pypy/dist/pypy/lib/logic/computation_space/distributor.py Tue Mar 7 12:13:49 2006
@@ -146,11 +146,11 @@
#self.cs._process() # propagate first
#better let clone() do this call
while self.cs._distributable():
+ self.cs.STABLE.bind(True)
+ choice = self.cs.choose(self.nb_subdomains())
if self.cs.status == Forsaken:
print "-- distributor (%s) ready for GC --" % self.cs.id
break
- self.cs.STABLE.bind(True)
- choice = self.cs.choose(self.nb_subdomains())
print "-- distribution & propagation (%s) --" % self.cs.id
self.distribute(choice-1)
self.cs._process()
@@ -160,7 +160,6 @@
def distribute(self, choice):
- """See AbstractDistributor"""
variable = self.findSmallestDomain()
#variables = self.cs.get_variables_with_a_domain()
#domains = arrange_domains(self.cs, variables)
More information about the Pypy-commit
mailing list