Skip to content

Instantly share code, notes, and snippets.



Last active Jan 31, 2020
What would you like to do?
# Excerpt from
# coroutine that will be wrapped in a task
def foo():
mytid = yield GetTid()
# A system call
class GetTid(SystemCall):
def handle(self):
# The scheduler "injects" task in the
# system call
self.task.sendval = self.task.tid
class Scheduler(object):
def mainloop(self):
# RHS of foo's yied
result =
if isinstance(result, SystemCall):
result.task = task
result.sched = self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment