[pypy-svn] r20940 - pypy/dist/pypy/translator/c/test
tismer at codespeak.net
tismer at codespeak.net
Fri Dec 9 15:47:30 CET 2005
Author: tismer
Date: Fri Dec 9 15:47:29 2005
New Revision: 20940
Modified:
pypy/dist/pypy/translator/c/test/test_tasklets.py
Log:
temporary check-in. Problems were non-existing methods which were globals.
New problem: t.clocked cannot be set. I commented this out and it works
partially. My guess is that it is a problem to create the scheduler
instance statically: we get wrong annotations on this global thing.
Proposal: build the scheduler explicitly at run-time.
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 15:47:29 2005
@@ -73,7 +73,7 @@
def __init__(self, name, fn):
Resumable.__init__(self, fn)
self.name = name
- self.blocked = False
+ self.blocked = 0
self.data = -1
# propogates round suspend-resume to tell scheduler in run()
@@ -105,7 +105,7 @@
if self.balance <= 0:
t = self.queue.pop(0)
t.data = value
- t.blocked = 0
+ ##!!t.blocked = 0
scheduler.run_immediately(tasklet)
scheduler.schedule()
@@ -114,23 +114,23 @@
assert isinstance(t, Tasklet)
# let it wait for a receiver to come along
self.queue.append(t)
- t.blocked = 1
- scheduler.schedule_remove()
+ ##!!t.blocked = 1
+ schedule_remove()
def receive(self):
self.balance -= 1
# good to go
if self.balance >= 0:
t = self.queue.pop(0)
- t.blocked = 0
+ ##!!t.blocked = 0
scheduler.add_tasklet(t)
else:
# block until ready
t = getcurrent()
self.queue.append(t)
- t.blocked = -1
- scheduler.schedule_remove()
+ ##!!t.blocked = -1
+ schedule_remove()
class Scheduler(object):
def __init__(self):
More information about the Pypy-commit
mailing list