qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Coroutines and ucontext


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] Coroutines and ucontext
Date: Fri, 27 Jan 2012 14:48:11 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Jan 27, 2012 at 03:39:22PM +0100, Paolo Bonzini wrote:
> On 01/27/2012 01:39 PM, Alex Barcelo wrote:
> >I have read that one of the reasons for using makecontext is that it
> >saves the signal state. But there also exist functions like
> >"sigsetjmp" and "siglongjmp" which can be used to jump around the
> >coroutines while preserving signal masks.
> >
> >I have a patch that uses sigsetjmp and siglongjmp instead of
> >makecontext and getcontext (and all the ucontext stuff), and it
> >*seems* to work... but I'm not sure if it works "by accident" (not
> >sure what I'm doing to the stack, not sure what I should be doing to
> >the stack).
> 
> You can post it, don't worry.  I'm curious how you are switching
> stacks when creating the coroutine.

If you're curious about this kind of thing you might also want to
take a look at the GNU Pth code. In particular its pth_mctx.c
file which has several different implementations of userspace thread
switching, one using makecontext, another with sigstck/altstack
and some others doing something fugly I don't understand :-)

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]