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 ^^ On Fri, Jan 27, 2012 at 15:48, Daniel P. Berrange wrote: >(...) > 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 :-) Thanks! I will definetely look at it/them.