[pypy-svn] r31352 - pypy/dist/pypy/objspace/cclp
auc at codespeak.net
auc at codespeak.net
Wed Aug 16 18:31:16 CEST 2006
Author: auc
Date: Wed Aug 16 18:31:14 2006
New Revision: 31352
Modified:
pypy/dist/pypy/objspace/cclp/space.py
pypy/dist/pypy/objspace/cclp/thunk.py
Log:
setting the distributor
Modified: pypy/dist/pypy/objspace/cclp/space.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/space.py (original)
+++ pypy/dist/pypy/objspace/cclp/space.py Wed Aug 16 18:31:14 2006
@@ -40,7 +40,7 @@
try:
return space.newint(cspace.choose(w_n.intval))
except ConsistencyError:
- raise OperationError(space.w_ConsistecyError,
+ raise OperationError(space.w_ConsistencyError,
space.wrap("the space is failed"))
raise OperationError(space.w_RuntimeError,
space.wrap("choose is forbidden from the top-level space"))
@@ -62,7 +62,7 @@
assert (parent is None) or isinstance(parent, W_CSpace)
self.space = space # the object space ;-)
self.parent = parent
- self.main_thread = thread
+ self.distributor = thread
# choice mgmt
self._choice = newvar(space)
self._committed = newvar(space)
Modified: pypy/dist/pypy/objspace/cclp/thunk.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/thunk.py (original)
+++ pypy/dist/pypy/objspace/cclp/thunk.py Wed Aug 16 18:31:14 2006
@@ -76,10 +76,14 @@
_AppThunk.__init__(self, space, coro.costate, w_callable, args)
self._coro = coro
+ def is_distributor(self):
+ return self._coro == self._coro._cspace.distributor
+
def call(self):
w("-- initial thunk CALL in", str(id(self._coro)))
scheduler[0].trace_vars(self._coro, logic_args(self.args.unpack()))
cspace = self._coro._cspace
+ cspace.distributor = self._coro
try:
try:
_AppThunk.call(self)
@@ -87,10 +91,15 @@
w("-- exceptional EXIT of cspace", str(id(self._coro)), "with", str(exc))
scheduler[0].dirty_traced_vars(self._coro, W_FailedValue(exc))
self._coro._dead = True
- self.space.bind(cspace._choice, self.space.wrap(SPACE_FAILURE))
+ if self.is_distributor():
+ cspace.fail()
+ import traceback
+ traceback.print_exc()
else:
w("-- clean (valueless) EXIT of cspace", str(id(self._coro)))
- self.space.bind(cspace._solution, self.costate.w_tempval)
+ interp_bind(cspace._solution, self.costate.w_tempval)
+ if self.is_distributor():
+ interp_bind(cspace._choice, self.space.newint(1))
finally:
scheduler[0].remove_thread(self._coro)
scheduler[0].schedule()
@@ -139,6 +148,7 @@
coro = self.coro
try:
cspace = coro._cspace
+ cspace.distributor = coro
dist = self.dist
try:
while dist.distributable():
More information about the Pypy-commit
mailing list