Il 19/03/2013 11:12, Peter Maydell ha scritto: > On 19 March 2013 09:30, Markus Armbruster <arm...@redhat.com> wrote: >> Coroutines are a perfectly pedestrian control flow construct. > > In some languages, sure. Not in C, and we're writing C. > >> Coroutines fit about as well with C as threads, namely not really. > > Threads are supported by the language runtime provided on all > the systems we support, which is why they are reasonably usable. > When you've persuaded glibc, MacOSX libc and Windows to implement > coroutines please come back and let me know :-)
Windows supports them (it calls them fibers) and glibc does on many architectures (all but ARM, basically). Paolo >> If portable coroutines in C really was an intractable problem, the >> solution could not be "no more coroutines, please", only "no coroutines, >> period". As long as we have to pay the price for coroutines anyway, I >> can't see why we should deny ourselves the benefits. > > I'd like to see coroutines gone completely. The first step is not > to let them get used more than they are already. > >> C programs have been doing coroutines since forever, using either hand >> coded assembly language stack switching, sigaltstack() trickery, >> ucontext(), w32 fibers, or some coroutine library built on top of these. > > ...and there's a wide range of really nasty options because none > of them are actually decent solutions to the problem. > > -- PMM >