On Sat, Aug 11, 2012 at 01:50:58PM +0200, Emmanuel Dreyfus wrote:
> Martin Husemann <mar...@duskware.de> wrote:
> 
> > However, for a dummie like me who hasn't seen the code in question, could
> > you please explain how they handle the stack pointer in the context?
> 
> - get current ucontext_t wht getcontext();
> - allocate a stack with malloc(), add it to ucontext_t (uc_stack field)
> - call makecontext() to set the target function and argument
> - call swapcontext()

Ah, IC, so every task has its own stack and you never use the original pthread
thread stack. Yes, this would work (and swapcontext deals with the register
windows).

Thanks for explanation,

Martin

Reply via email to