On Tue, Nov 5, 2013 at 8:04 AM, Tom Hacohen <tom.haco...@samsung.com> wrote:

> /* The idea of this trick come from libcoroutine */
>     /* __jmpbuf[6] == stack pointer */
>     /* __jmpbuf[7] == program counter */
>     coro->context->env[0].__jmpbuf[6] = ((uintptr_t)(&coro->stack));
>     coro->context->env[0].__jmpbuf[7] =
> ((uintptr_t)_ecore_coroutine_entry_point);
>
> This is not portable. I've used this before at uni and the thing failed
> miserably on old systems. Also, as you can see from it, it's not really
> clean and can break at any time...
>

That's why ucontext has makecontext(): to hide the platform intricacies
inside libc, which is where these kind of assumptions should be made.

However, as much as I like coroutines -- and Cedric wrote this code based
on the code I wrote for my toy web server -- if they're not being used in
EFL or EFL-using applications, I'm also on the yank-it-bandwagon.

They can lead to some hard-to-debug situations and EFL codebase is complex
enough to guarantee debugging usual issues aren't necessarily a walk in the
park. If you add coroutines to the mix, specially in some general-purpose
library that has not been designed to work with coroutines, things will get
pretty chaotic: useless stack traces, stack overflows (specially on small
stacks like the current implementation), Valgrind getting crazy, etc.

    Leandro
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to