tech-kern archive

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

Re: swapcontext() around pthreads

On Thu, Aug 09, 2012 at 04:13:43PM +0000, Emmanuel Dreyfus wrote:
> I encountered a funny portability problem when working on glusterfs.
> In its 3.3. branch, it makes heavy use of swapcontext() and pthreads
> to get better performance. Unfortunately the code assumes a Linux
> specific behavior : a thread calling swapcontext() should not affect 
> other threads. Only the calling thread context should be changed.

It sounds a lot like you should be using setjmp/longjmp in first place.
swapcontext works exactly as advertised and e.g. the thread base is part
of the context.


Home | Main Index | Thread Index | Old Index