This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Coroutines


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?  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.  As long as you don't change the API, that'll get
you portability to systems you haven't even heard of, let alone seen.

You can prototype the runtime library with pthreads in the knowledge
that you can do something else later.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]