tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: swapcontext() around pthreads



hi,

> On Thu, Aug 09, 2012 at 08:44:05PM +0200, Emmanuel Dreyfus wrote:
>> setjmp and longjmp are claim to not match the requirement because they
>> do not allow different stacks for each execution context.
> 
> But there is a strong correlation between thread and stack, you can not
> switch one without the other. So what is the intended semantics if you
> setcontext() in thread A with a context created by thread B while B is
> currently running on another CPU?

no problem if you played with uc_stack and makecontext appropriately.
i guess it's what glusterfs does.

iirc linux swapcontext excludes the thread base from the context
intentionally to allow this kind of usage.

YAMAMOTO Takashi

> 
> Martin


Home | Main Index | Thread Index | Old Index