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: Stefan Hajnoczi
Subject: Re: [Qemu-devel] Coroutines and ucontext
Date: Tue, 7 Feb 2012 11:18:37 +0000

On Sat, Jan 28, 2012 at 9:31 AM, Alex Barcelo <address@hidden> wrote:
> On Fri, Jan 27, 2012 at 15:39, Paolo Bonzini wrote:
>>> 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.
>>
>
> I think that I'm not switching, so at first I didn't understand why
> could it run at all. Now I think that qemu-img is too simple and a new
> stack is not really needed (probably only one coroutine and
> straightforward, I'll check it). So it doesn't crash.
>
> Thank you very much for the advice and comments. I'll do some more
> tests, I expect to achieve something useful ^^

The way that you can use the setjmp/longjmp family of functions for
creating stacks is by manipulating the fields inside jmpbuf.  However,
it seemed slightly more portable and less hacky to use ucontext
functions instead of doing that.

Stefan



reply via email to

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