[pypy-svn] r20930 - pypy/dist/pypy/translator/c/test
rxe at codespeak.net
rxe at codespeak.net
Fri Dec 9 12:56:26 CET 2005
Author: rxe
Date: Fri Dec 9 12:56:25 2005
New Revision: 20930
Modified:
pypy/dist/pypy/translator/c/test/test_tasklets.py
Log:
Resumable included too much - thanks Chris.
(this is all just experimental, wouldnt read too closely)
Modified: pypy/dist/pypy/translator/c/test/test_tasklets.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_tasklets.py (original)
+++ pypy/dist/pypy/translator/c/test/test_tasklets.py Fri Dec 9 12:56:25 2005
@@ -52,10 +52,6 @@
def __init__(self, fn):
self.fn = fn
self.alive = False
-
- # propogates round suspend-resume to tell scheduler in run()
- # XXX too late to think this thru
- self.remove = False
def start(self):
self.caller = yield_current_frame_to_caller()
@@ -65,20 +61,12 @@
def set_resumable(self, resumable):
self.resumable = resumable
- def suspend(self, remove):
+ def suspend(self):
self.caller = self.caller.switch()
- self.remove = remove
def resume(self):
- debug("resuming %s" % self.name)
self.resumable = self.resumable.switch()
self.alive = self.resumable is not None
- # not sure what to do with alive yetXXX
-
- #XXX arggh - why NOT??
- #if not alive:
- # self.caller = # None / NULL
- return self.alive and not self.remove
class Tasklet(Resumable):
def __init__(self, name, fn):
@@ -86,6 +74,23 @@
self.name = name
self.blocked = False
+ # propogates round suspend-resume to tell scheduler in run()
+ # XXX too late to think this thru
+ self.remove = False
+
+ def suspend_and_remove(self, remove):
+ self.suspend()
+ self.remove = remove
+
+ def resume(self):
+ Resumable.resume(self)
+ # not sure what to do with alive yetXXX
+
+ #XXX arggh - why NOT??
+ #if not alive:
+ # self.caller = # None / NULL
+ return self.alive and not self.remove
+
class Channel:
def __init__(self):
self.balance = 0
@@ -145,7 +150,7 @@
def schedule(self, remove=False):
assert self.current_tasklet is not None
- self.current_tasklet.suspend(remove)
+ self.current_tasklet.suspend_and_remove(remove)
# ____________________________________________________________
More information about the Pypy-commit
mailing list