[pypy-svn] r28801 - pypy/dist/pypy/lib
stephan at codespeak.net
stephan at codespeak.net
Thu Jun 15 10:59:09 CEST 2006
Author: stephan
Date: Thu Jun 15 10:59:08 2006
New Revision: 28801
Modified:
pypy/dist/pypy/lib/stackless.py
Log:
added missing 'schedule_remove'
Modified: pypy/dist/pypy/lib/stackless.py
==============================================================================
--- pypy/dist/pypy/lib/stackless.py (original)
+++ pypy/dist/pypy/lib/stackless.py Thu Jun 15 10:59:08 2006
@@ -134,15 +134,6 @@
"""
pass
-def schedule_remove(retval=None):
- """
- schedule(retval=stackless.current) -- switch to the next runnable tasklet.
- The return value for this call is retval, with the current
- tasklet as default.
- schedule_remove(retval=stackless.current) -- ditto, and remove self.
- """
- pass
-
def set_channel_callback(callable):
"""
set_channel_callback(callable) -- install a callback for channels.
@@ -224,6 +215,26 @@
def getmain():
return main_tasklet
+def _do_schedule(retval=None, remove=False):
+ prev = scheduler._head
+ next = prev.next
+ if remove:
+ scheduler.current_remove()
+ ret = scheduler.schedule_task(prev, next)
+ if retval is None:
+ return ret
+ else:
+ return retval
+
+def schedule_remove(retval=None):
+ """
+ schedule(retval=stackless.current) -- switch to the next runnable tasklet.
+ The return value for this call is retval, with the current
+ tasklet as default.
+ schedule_remove(retval=stackless.current) -- ditto, and remove self.
+ """
+ return _do_schedule(retval, True)
+
def schedule(retval=None):
"""
schedule(retval=stackless.current) -- switch to the next runnable tasklet.
@@ -231,9 +242,7 @@
tasklet as default.
schedule_remove(retval=stackless.current) -- ditto, and remove self.
"""
- prev = scheduler._head
- next = prev.next
- return scheduler.schedule_task(prev, next)
+ return _do_schedule(retval, False)
class tasklet(coroutine):
"""
More information about the Pypy-commit
mailing list