Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!texbell!uhnix1!sugar!ficc!peter
From: peter@ficc.uu.net (Peter da Silva)
Newsgroups: comp.lang.c
Subject: Re: Coroutines in C
Message-ID: <5695@ficc.uu.net>
Date: 15 Aug 89 17:00:21 GMT
References: <5663@ficc.uu.net> <14281@haddock.ima.isc.com> <563@augean.OZ>
Organization: Xenix Support, FICC
Lines: 34

In article <563@augean.OZ>, idall@augean.OZ (Ian Dall) writes:
> The scheme seems workable
> but portable implimentation is no doubt impossible

No, which is why the basic routines need to be standardised, at least to
the point where people implementing them on different compilers can agree
to the names and calling conventions.

> and it may not be possible
> to impliment at all on some machines.

True, but machines like that are likely to cause problems with varargs,
setjmp/longjmp, and so on as well.

> Would making the coroutine functions
> compiler "builtin" inline functions allow implimentation on a larger variety
> of machines?

Probably not. The difficulty is dealing with exotic stacks, not where the
code is done. As a thought experiment consider the case of making the
cocall from a subroutine of the coroutine... if inline code was needed
that would not be possible.

> What sort of problems do you want coroutines for? I seem to have survived about
> 14 years of programming without ever using them!

Mainly for the sort of event-loop programming endemic to windowing systems.
It would be easier to code this sort of application if minithreads were
available.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Business: peter@ficc.uu.net, +1 713 274 5180. | "The sentence I am now
Personal: peter@sugar.hackercorp.com.   `-_-' |  writing is the sentence
Quote: Have you hugged your wolf today?  'U`  |  you are now reading"