From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R22bu-0006VT-Ql for qemu-devel@nongnu.org; Fri, 09 Sep 2011 11:03:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R22bs-0007Hs-QK for qemu-devel@nongnu.org; Fri, 09 Sep 2011 11:03:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R22bs-0007Hk-Dk for qemu-devel@nongnu.org; Fri, 09 Sep 2011 11:03:16 -0400 Message-ID: <4E6A2AA6.3070900@redhat.com> Date: Fri, 09 Sep 2011 17:03:02 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1315495505-28906-1-git-send-email-pbonzini@redhat.com> <1315495505-28906-12-git-send-email-pbonzini@redhat.com> <4E6A2818.7070209@bytemark.co.uk> In-Reply-To: <4E6A2818.7070209@bytemark.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/12] nbd: switch to asynchronous operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nicholas Thomas Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 09/09/2011 04:52 PM, Nicholas Thomas wrote: > I'm a bit unsure here, actually. So you lock a mutex, send a request, > wait for a response, then unlock the mutex. Surely this code doesn't > allow more than one request to be in flight at a time? No, it doesn't. It shouldn't be hard to do it though. You could have two mutexes, one for sending and one for receiving. You yield after sending, and let nbd_coroutine_restart read the reply. It can then reenter that reply's coroutine based on the handle in the reply. I still prefer to do it in a separate patch. Paolo