From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rr4dB-0003CJ-3I for qemu-devel@nongnu.org; Sat, 28 Jan 2012 04:31:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rr4d9-0000cZ-TE for qemu-devel@nongnu.org; Sat, 28 Jan 2012 04:31:32 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:58950) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rr4d9-0000cV-OY for qemu-devel@nongnu.org; Sat, 28 Jan 2012 04:31:31 -0500 Received: by dajr28 with SMTP id r28so2663059daj.4 for ; Sat, 28 Jan 2012 01:31:30 -0800 (PST) MIME-Version: 1.0 Sender: alex.barcelo@gmail.com In-Reply-To: <4F22B71A.3020805@redhat.com> References: <4F22B71A.3020805@redhat.com> From: Alex Barcelo Date: Sat, 28 Jan 2012 10:31:10 +0100 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Coroutines and ucontext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel 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. =A0I'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.