On 26 November 2013 15:12, Paolo Bonzini <pbonz...@redhat.com> wrote: > Il 26/11/2013 16:06, Marc-André Lureau ha scritto: >> At least 3 glib projects share a similar coroutine implementation >> (gtk-vnc, spice-gtk and qemu). So I decided to propose adding >> coroutine support in GLib. I made some changes regarding the API to be >> slightly more generic. I invite you to review and participate to the >> RFC bug https://bugzilla.gnome.org/show_bug.cgi?id=719362. >> >> If the proposal isn't refused, I'll keep working on it as it's >> incomplete at this point and will provide a qemu patch as a proof of >> concept. > > Note that makecontext does not work on at least ARM (and I think some > BSDs too),
We did get makecontext() fixed in ARM glibc, so unless you're still using an ancient glibc you're probably OK. The general point remains though -- coroutines in C are nastily non-portable, which is why qemu has four different implementations of the basic primitives. Personally I think the correct answer is to accept that C is not a language with coroutines (or to push for them to be added to the next version of the C standard). -- PMM