[racket-dev] Coroutines (mzlib/thread)

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Jul 20 16:50:52 EDT 2012

Hi all,

I've been moving some libraries from mzlib to more appropriate places
recently. I was meaning to move `mzlib/thread` to `racket/coroutine`,
but had some questions about its API.

It appears that the coroutines from `mzlib/thread` don't actually
provide a built-in way to yield the computation to another coroutine.
Instead, the coroutine is run with either a timeout or an event that
suspends the computation and returns to the caller.

Is this a useful coroutine API? It seems that to encode the typical
`yield` construct you need to set up your own protocol with, say, a
channel to trigger a context switch and then do scheduling manually. If
we're going to bother providing it as a `racket` library, should we try
to improve the API?

NB: the only use I could find in the code base was in


Posted on the dev mailing list.