Re: getcontext/setcontext alternatives
Re: getcontext/setcontext alternatives
Posted May 9, 2012 11:20 UTC (Wed) by geertj (guest, #4116)In reply to: Re: getcontext/setcontext alternatives by scottt
Parent article: nPth - The new GNU portable threads library
> writing per arch "stack switching" code like cgreenlet/greenlet-asm.S?
One trick that is sometimes used is sigaltstack() + setjmp(). However i would argue this is actually less portable than writing assembly (the assembly you refer to above is not OS specific, it is only architecture specific and the same function it works on Linux, Mac OSX and Windows).
In the best case, we would get a working and not-deprecated makecontext() function from libc at some point. Also we would need to get an extended longjmp() that allows for code injection in the target co-routine (for propagating exceptions in C++).
Posted May 11, 2012 23:53 UTC (Fri)
by jwakely (subscriber, #60262)
[Link]
Re: getcontext/setcontext alternatives