Andrew Haley <aph@redhat.com> writes:
| Dustin Laurence writes:
| > On Fri, Jun 16, 2006 at 02:05:13PM -0700, Mike Stump wrote:
| >
| > > If every language were going to have the feature, then,
moving it
| > > down into the mid-end or back-end might make sense, but I
don't think
| > > it does in this case.
| >
| > Personally, I'd like, and use, decent coroutines in C. But
perhaps I am
| > the only one.
| >
| > > I wouldn't start with pthreads I don't think.
| >
| > That was my thought--I played with it some but I intended it
as a bit of
| > threads practice. Using threads to emulate a synchronous
construct just
| > seems *wrong.*
|
| You need a way to switch from one stack to another, but why not
leave
| open the possibility of implementing this in a number of different
| ways?
Yup.
| You need detach() and resume() [in Simula notation] and these
| can be provided either by low-level stack-switching or by invoking a
| pthreads library.
I wouldn't use a thread library because many uses of coroutine are to
implement low-cost, efficient, alternatives to thread where, for
example,
the full power of threads are not essential.
-- Gaby