On Tue, May 21, 2013 at 01:46:13PM +0200, Jorge Acereda Maciá wrote: > Hi, > > On May 21, 2013, at 7:46 AM, Alexander Burger <a...@software-lab.de> wrote: > > > The big question is: Will the system (which system?) do that? If so, how > > do other languages implement green threads, coroutines or continuations? > > Some OSs do provide the required functionality (e.g, the fibers API on > Windows). On POSIX, it's usually a matter of using some dirty hack > (setjmp()/longjmp() being the most portable, swapcontext() is also quite
setjmp()/longjmp() is what PicoLisp basically does, though it is done directly in assembly, not by using a library. In any case, the underlying mechanisms (i.e. the logic of above/below the stack pointer) are the same. So this would mean we are on the safe side. > The problem is so complex that perhaps your approach is the simplest. Yes, in assembly it is almost trivial. But it doesn't help if the OS has a different idea of what you're doing ;-) > Just take a look at how nasty the thing can get: > > http://code.google.com/p/libaw/source/browse/coroutine/source/Coro.c True. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe